From bbe874e5d2cba45ba3fe3cf7b2b4d05ae0f2595e Mon Sep 17 00:00:00 2001 From: Nitish Tiwari Date: Wed, 17 Jan 2024 12:14:36 +0530 Subject: [PATCH] make events per call configurable with P_EVENTS_COUNT --- quest_test.go | 2 ++ scripts/load_batch_events.js | 12 +++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/quest_test.go b/quest_test.go index 4270605..1d75136 100644 --- a/quest_test.go +++ b/quest_test.go @@ -30,6 +30,7 @@ const ( vus = "10" duration = "5m" schema_count = "20" + events_count = "10" ) func TestSmokeListLogStream(t *testing.T) { @@ -238,6 +239,7 @@ func TestLoadStreamBatchWithK6(t *testing.T) { "-e", fmt.Sprintf("P_PASSWORD=%s", NewGlob.Password), "-e", fmt.Sprintf("P_STREAM=%s", NewGlob.Stream), "-e", fmt.Sprintf("P_SCHEMA_COUNT=%s", schema_count), + "-e", fmt.Sprintf("P_EVENTS_COUNT=%s", schema_count), "./scripts/load_batch_events.js", "--vus=", vus, "--duration=", duration) diff --git a/scripts/load_batch_events.js b/scripts/load_batch_events.js index 6abf105..23e5dc3 100644 --- a/scripts/load_batch_events.js +++ b/scripts/load_batch_events.js @@ -24,6 +24,10 @@ function schemas() { return Number(__ENV.P_SCHEMA_COUNT) } +function events_per_call() { + return Number(__ENV.P_EVENTS_COUNT) +} + const common_schema = [ { "name": "source_time", "gen": current_time, "arg": null }, { "name": "level", "gen": randomItem, "arg": ["info", "warn", "error"] }, @@ -168,7 +172,13 @@ export default function () { } } - let batch_requests = JSON.stringify(generateEvents(10)); + let events = events_per_call(); + + if (!events) { + events = 10 + } + + let batch_requests = JSON.stringify(generateEvents(events)); let response = http.post(url, batch_requests, params); if (