Skip to content

Commit

Permalink
feat: Fail tests if status code is not 200
Browse files Browse the repository at this point in the history
  • Loading branch information
bprusinowski committed Dec 14, 2023
1 parent 097fc78 commit 5486909
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
7 changes: 6 additions & 1 deletion k6/performance-tests/graphql/DataCubeComponents.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { check, fail } from "k6";
import exec from "k6/execution";
import http from "k6/http";

Expand Down Expand Up @@ -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!");
}
}
7 changes: 6 additions & 1 deletion k6/performance-tests/graphql/DataCubeMetadata.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { check, fail } from "k6";
import exec from "k6/execution";
import http from "k6/http";

Expand Down Expand Up @@ -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!");
}
}
7 changes: 6 additions & 1 deletion k6/performance-tests/graphql/DataCubePreview.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { check, fail } from "k6";
import exec from "k6/execution";
import http from "k6/http";

Expand Down Expand Up @@ -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!");
}
}

1 comment on commit 5486909

@vercel
Copy link

@vercel vercel bot commented on 5486909 Dec 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

visualization-tool – ./

visualization-tool-alpha.vercel.app
visualization-tool-git-main-ixt1.vercel.app
visualization-tool-ixt1.vercel.app

Please sign in to comment.