Skip to content

Commit

Permalink
add file-to-blackhole performance test
Browse files Browse the repository at this point in the history
  • Loading branch information
Assassin718 committed Jul 16, 2024
1 parent 762a3f3 commit 09dc837
Show file tree
Hide file tree
Showing 24 changed files with 378 additions and 58 deletions.
1 change: 1 addition & 0 deletions test/benchmark/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ func TestMain(m *testing.M) {
func scenarioInitializer(ctx *godog.ScenarioContext) {
// Given
ctx.Given(`^\{(\S+)\} environment$`, setup.InitEnv)
ctx.Given(`^docker-compose type \{(\S+)\}$`, setup.SetDockerComposeType)
ctx.Given(`^iLogtail depends on containers \{(.*)\}`, setup.SetDockerComposeDependOn)
ctx.Given(`^iLogtail container mount \{(.*)\} to \{(.*)\}`, setup.MountVolume)
ctx.Given(`^iLogtail expose port \{(.*)\} to \{(.*)\}`, setup.ExposePort)
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
@input
Feature: performance file to blackhole filebeat
Performance file to blackhole filebeat

@e2e-performance @docker-compose
Scenario: PerformanceFileToBlackholeFilebeat
Given {docker-compose} environment
Given docker-compose type {benchmark}
When start docker-compose {performance_file_to_blackhole_filebeat}
When start monitor {e2e-filebeat-1}
When generate logs to file, speed {10}MB/s, total {3}min, to file {./a.log}, template
"""
{"url": "POST /PutData?Category=YunOsAccountOpLog HTTP/1.1", "ip": "10.200.98.220", "user-agent": "aliyun-sdk-java", "request": {"status": "200", "latency": "18204"}, "time": "07/Jul/2022:10:30:28"}
"""
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
version: '3.8'

services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:8.14.2
environment:
- ELASTIC_PASSWORD=elastic
- discovery.type=single-node
- xpack.security.http.ssl.enabled=false
- xpack.license.self_generated.type=trial
ports:
- 9200:9200
healthcheck:
test: ["CMD-SHELL", "curl -u elastic:elastic -s http://localhost:9200/_cluster/health | grep -q '\"status\":\"green\"'"]
interval: 10s
timeout: 5s
retries: 3
restart: always

filebeat:
image: docker.elastic.co/beats/filebeat:8.14.2
user: root
volumes:
- ./filebeat.yml:/usr/share/filebeat/filebeat.yml:ro
- ./a.log:/home/filebeat/a.log:ro
command: filebeat -e --strict.perms=false
environment:
- OUTPUT_ELASTICSEARCH_HOSTS=["elasticsearch:9200"]
depends_on:
elasticsearch:
condition: service_healthy
restart: always
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
filebeat.inputs:
- type: filestream
id: input-file
paths:
- /home/filebeat/a.log
- decode_json_fields:
fields: ["message"]
target: "json"

output.discard:
enabled: true
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
@input
Feature: performance file to blackhole fluentbit
Performance file to blackhole fluentbit

@e2e-performance @docker-compose
Scenario: PerformanceFileToBlackholeFluentbit
Given {docker-compose} environment
Given docker-compose type {benchmark}
When start docker-compose {performance_file_to_blackhole_fluentbit}
When start monitor {e2e-fluent-bit-1}
When generate logs to file, speed {10}MB/s, total {3}min, to file {./a.log}, template
"""
{"url": "POST /PutData?Category=YunOsAccountOpLog HTTP/1.1", "ip": "10.200.98.220", "user-agent": "aliyun-sdk-java", "request": {"status": "200", "latency": "18204"}, "time": "07/Jul/2022:10:30:28"}
"""
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: '3.8'

services:

fluent-bit:
image: cr.fluentbit.io/fluent/fluent-bit
command: ["-c", "/tmp/main.conf"]
volumes:
- ./main.conf:/tmp/main.conf
- ./parsers.conf:/tmp/parsers.conf
- ./a.log:/home/fluentbit/a.log
restart: always


Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[SERVICE]
Parsers+File /tmp/parsers.conf

[INPUT]
Name tail
Path /home/fluentbit/a.log

[OUTPUT]
Name stdout
Match non
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[PARSER]
Name docker
Format json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ Feature: performance file to blackhole iLogtail
@e2e-performance @docker-compose
Scenario: PerformanceFileToBlackholeiLogtail
Given {docker-compose} environment
Given subcribe data from {grpc} with config
"""
"""
Given {performance-file-to-blackhole-ilogtail-case} local config as below
"""
enable: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ services:
privileged: true
devices:
- /dev/kmsg
restart: unless-stopped
restart: always
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
@input
Feature: performance file to blackhole vector
Performance file to blackhole vector

@e2e-performance @docker-compose
Scenario: PerformanceFileToBlackholeVector
Given {docker-compose} environment
Given docker-compose type {benchmark}
When start docker-compose {performance_file_to_blackhole_vector}
When start monitor {e2e-vector-1}
When generate logs to file, speed {10}MB/s, total {3}min, to file {./a.log}, template
"""
{"url": "POST /PutData?Category=YunOsAccountOpLog HTTP/1.1", "ip": "10.200.98.220", "user-agent": "aliyun-sdk-java", "request": {"status": "200", "latency": "18204"}, "time": "07/Jul/2022:10:30:28"}
"""
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: '3.8'

services:
vector:
image: timberio/vector:0.39.0-debian
volumes:
- ./vector.yaml:/etc/vector/vector.yaml
- ./a.log:/home/vector-log/a.log
restart: always
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
sources:
input_file:
type: file
include:
- /home/vector-log/*.log

sinks:
my_sink_id:
type: blackhole
inputs:
- input_file
1 change: 1 addition & 0 deletions test/engine/cleanup/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ func All() {
_, _ = GoTestCache(ctx)
_, _ = StopMonitor(ctx)
_, _ = DeleteContainers(ctx)
// FIXME: if this test case has no subscriber and the previous one has subscriber, it will panic
if subscriber.TestSubscriber != nil {
_ = subscriber.TestSubscriber.Stop()
}
Expand Down
4 changes: 2 additions & 2 deletions test/engine/setup/controller/docker_compose_boot.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ import (
type BootController struct {
}

func (c *BootController) Init() error {
func (c *BootController) Init(initType string) error {
logger.Info(context.Background(), "boot controller is initializing....")
return dockercompose.Load()
return dockercompose.Load(initType)
}

func (c *BootController) Start(ctx context.Context) error {
Expand Down
8 changes: 7 additions & 1 deletion test/engine/setup/docker_compose.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,16 @@ import (

const dependencyHome = "test_cases"

var dockerComposeType = "e2e"

type DockerComposeEnv struct {
BootController *controller.BootController
}

func SetDockerComposeType(t string) {
dockerComposeType = t
}

func StartDockerComposeEnv(ctx context.Context, dependencyName string) (context.Context, error) {
if dockerComposeEnv, ok := Env.(*DockerComposeEnv); ok {
path := dependencyHome + "/" + dependencyName
Expand All @@ -28,7 +34,7 @@ func StartDockerComposeEnv(ctx context.Context, dependencyName string) (context.
return ctx, err
}
dockerComposeEnv.BootController = new(controller.BootController)
if err = dockerComposeEnv.BootController.Init(); err != nil {
if err = dockerComposeEnv.BootController.Init(dockerComposeType); err != nil {
return ctx, err
}

Expand Down
11 changes: 9 additions & 2 deletions test/engine/setup/dockercompose/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,17 @@ type Booter interface {
}

// Load configuration to the Booter.
func Load() error {
func Load(loadType string) error {
mu.Lock()
defer mu.Unlock()
instance = NewComposeBooter()
switch loadType {
case "e2e":
instance = NewComposeBooter()
case "benchmark":
instance = NewComposeBenchmarkBooter()
default:
return errors.New("invalid load type")
}
return nil
}

Expand Down
Loading

0 comments on commit 09dc837

Please sign in to comment.