From 71476cc7a9e473abf36ec74b7e394b88a355fe20 Mon Sep 17 00:00:00 2001 From: Mircea Hasegan Date: Wed, 18 Sep 2024 10:22:16 +0200 Subject: [PATCH] test(e2e): abort k6 wallets test if too many failed requests WHY: - show that test is failing, otherwise failed requests are considered successful with small response time - To save on K6 VUh --- packages/e2e/test/k6/scenarios/wallets.test.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/e2e/test/k6/scenarios/wallets.test.js b/packages/e2e/test/k6/scenarios/wallets.test.js index 8bb0e4d17fb..d9e0d5da315 100644 --- a/packages/e2e/test/k6/scenarios/wallets.test.js +++ b/packages/e2e/test/k6/scenarios/wallets.test.js @@ -161,11 +161,19 @@ export const options = { } }, thresholds: { + http_req_failed: [ + { + // Stop the test if more than 10% of requests fail to avoid using VUh for nothing + abortOnFail: true, + // Wait for 2 minutes to get more data. If the error rate is still high, the test will fail + delayAbortEval: '2m', + threshold: 'rate<0.1' + } + ], // All wallets should have syncd // Use https://k6.io/docs/using-k6/thresholds/ to set more thresholds. E.g.: // wallet_sync: ['p(95)<5000'], // 95% of wallets should sync in under 5 seconds wallet_sync: [{ delayAbortEval: '5s', threshold: 'p(95) < 30000' }], - wallet_sync_count: [`count >= ${MAX_VU}`] // We get a nice graph if we enable thresholds. See this stat on a graph } };