diff --git a/k6/performance-tests/graphql/DataCubeComponents.js b/k6/performance-tests/graphql/DataCubeComponents.js index 2809d1fc9..63ce4cba0 100644 --- a/k6/performance-tests/graphql/DataCubeComponents.js +++ b/k6/performance-tests/graphql/DataCubeComponents.js @@ -1,3 +1,4 @@ +import { check, fail } from "k6"; import exec from "k6/execution"; import http from "k6/http"; @@ -42,9 +43,13 @@ export default function Components() { exec.vu.metrics.tags.env = env; exec.vu.metrics.tags.cube = cubeLabel; - http.post( + const res = http.post( `https://${env === "prod" ? "" : `${env}.`}visualize.admin.ch/api/graphql`, JSON.stringify({ query, variables }), { headers } ); + + if (!check(res, { "Status code must be 200": (res) => res.status == 200 })) { + fail("Status code was *not* 200!"); + } } diff --git a/k6/performance-tests/graphql/DataCubeMetadata.js b/k6/performance-tests/graphql/DataCubeMetadata.js index 1552b7bf3..5c10525b2 100644 --- a/k6/performance-tests/graphql/DataCubeMetadata.js +++ b/k6/performance-tests/graphql/DataCubeMetadata.js @@ -1,3 +1,4 @@ +import { check, fail } from "k6"; import exec from "k6/execution"; import http from "k6/http"; @@ -42,9 +43,13 @@ export default function Components() { exec.vu.metrics.tags.env = env; exec.vu.metrics.tags.cube = cubeLabel; - http.post( + const res = http.post( `https://${env === "prod" ? "" : `${env}.`}visualize.admin.ch/api/graphql`, JSON.stringify({ query, variables }), { headers } ); + + if (!check(res, { "Status code must be 200": (res) => res.status == 200 })) { + fail("Status code was *not* 200!"); + } } diff --git a/k6/performance-tests/graphql/DataCubePreview.js b/k6/performance-tests/graphql/DataCubePreview.js index 8f8c64e44..4886c842d 100644 --- a/k6/performance-tests/graphql/DataCubePreview.js +++ b/k6/performance-tests/graphql/DataCubePreview.js @@ -1,3 +1,4 @@ +import { check, fail } from "k6"; import exec from "k6/execution"; import http from "k6/http"; @@ -59,9 +60,13 @@ export default function Components() { exec.vu.metrics.tags.env = env; exec.vu.metrics.tags.cube = cubeLabel; - http.post( + const res = http.post( `https://${env === "prod" ? "" : `${env}.`}visualize.admin.ch/api/graphql`, JSON.stringify({ query, variables }), { headers } ); + + if (!check(res, { "Status code must be 200": (res) => res.status == 200 })) { + fail("Status code was *not* 200!"); + } }