From 35bcc7310c0f1bde1ea18987e242de0f4963c08f Mon Sep 17 00:00:00 2001 From: Cassidy Scheffer Date: Thu, 17 Oct 2024 10:15:58 -0400 Subject: [PATCH] move checks to thresholds --- k6/integration-test.js | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/k6/integration-test.js b/k6/integration-test.js index 391e719..3992593 100644 --- a/k6/integration-test.js +++ b/k6/integration-test.js @@ -25,8 +25,24 @@ export const options = { }, }, thresholds: { - "http_req_duration{hive:enabled}": ["p(95)<15"], - "http_req_duration{hive:disabled}": ["p(95)<15"], + "http_req_duration{hive:enabled}": [ + { + threshold: "p(95)<15", + abortOnFail: true, + }, + ], + "http_req_duration{hive:disabled}": [ + { + threshold: "p(95)<15", + abortOnFail: true, + }, + ], + checks: [ + { + threshold: "rate===1", + abortOnFail: true, + }, + ], }, }; @@ -77,7 +93,6 @@ function sleep(seconds) { return new Promise((resolve) => setTimeout(resolve, seconds * 1000)); } -function checkCount(count) {} export function teardown(data) { let count; const res = http.get("http://localhost:8888/count"); @@ -95,26 +110,24 @@ export function teardown(data) { } export function handleSummary(data) { - postGithubComment(data); + const checks = data.metrics.checks; + const didPass = checks.failed === 0; + postGithubComment(data, didPass); return { stdout: textSummary(data, { indent: " ", enableColors: true }), }; } -function postGithubComment(data) { +function postGithubComment(data, didPass) { if (!__ENV.GITHUB_TOKEN) { return; } - - const checks = data.metrics.checks; - const didPass = checks.failed === 0; - githubComment(data, { token: __ENV.GITHUB_TOKEN, commit: __ENV.GITHUB_SHA, pr: __ENV.GITHUB_PR, - org: "charlypoly", + org: "rperryng", repo: "graphql-ruby-hive", renderTitle: () => didPass ? "✅ Integration Test Passed" : "❌ Integration Test Failed",