From 3a59f9be27aea01ca863e92766b5d6f61c8e4220 Mon Sep 17 00:00:00 2001 From: Olga Bulat Date: Fri, 29 Nov 2024 12:08:55 +0300 Subject: [PATCH] Modify k6 load tests (#5181) * Update the scenarios for k6 tests * Update the scenarios for k6 tests to run for 3m * Update the scenarios for k6 tests to run for 5m * Revert "Re-add the memory leak for testing" This reverts commit 38f40e89d005b9b68c8f214f22181c1995bb02cf. * Increase the rate x1.5 * Revert "Revert "Re-add the memory leak for testing"" This reverts commit a239799f2f27372bf73730339c57eecce59bd57f. * Increase the rate x2 * Decrease the rate back to 30 * Revert "Revert "Revert "Re-add the memory leak for testing""" This reverts commit 874fa666feb99494ec18d0630537320cd072638c. * Decrease the rate to 10 * Lower the duration to 4 minutes * Lower the rate to 3 * Lower the VU counts * Extract the defaultUiState to an object * Run longer in staging --- .github/workflows/k6.yml | 1 + packages/js/k6/src/frontend/scenarios.ts | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/k6.yml b/.github/workflows/k6.yml index faf4e3fe0b3..87a846fb3e9 100644 --- a/.github/workflows/k6.yml +++ b/.github/workflows/k6.yml @@ -55,6 +55,7 @@ jobs: just k6 ${{ inputs.namespace }} ${{ inputs.scenario }} \ ${{ inputs.report && '-o cloud' || ''}} \ -e signing_secret="$K6_SIGNING_SECRET" \ + -e scenario_duration="6m" \ -e service_url=${{ inputs.service_url }} \ -e text_summary=/tmp/k6-summary.txt diff --git a/packages/js/k6/src/frontend/scenarios.ts b/packages/js/k6/src/frontend/scenarios.ts index 5e5642deece..09cece59527 100644 --- a/packages/js/k6/src/frontend/scenarios.ts +++ b/packages/js/k6/src/frontend/scenarios.ts @@ -106,14 +106,17 @@ const createScenario = ( funcName: Action ): Scenario => { return { - executor: "per-vu-iterations", + executor: "constant-arrival-rate", env, exec: funcName, // k6 CLI flags do not allow override scenario options, so we need to add our own // Ideally we would use default // https://community.grafana.com/t/overriding-vus-individual-scenario/98923 - vus: parseFloat(__ENV.scenario_vus) || 5, - iterations: parseFloat(__ENV.scenario_iterations) || 40, + timeUnit: __ENV.scenario_time_utin || "1m", + rate: parseInt(__ENV.scenario_rate) || 3, + duration: __ENV.scenario_duration || "4m", + preAllocatedVUs: 10, + maxVUs: 20, } }