Skip to content

Commit 3dee5b7

Browse files
authored
fix: TT-232 checkputApi (#291)
1 parent 9ccfa23 commit 3dee5b7

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

timeTrackerCheckOut.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { check } from "k6";
2+
import http from "k6/http";
3+
import { Rate } from "k6/metrics";
4+
import { textSummary } from "https://jslib.k6.io/k6-summary/0.0.1/index.js";
5+
export let errorRate = new Rate("errors");
6+
7+
export let options = {
8+
thresholds: {
9+
errors: ["rate<0.1"], // <10% errors
10+
},
11+
};
12+
13+
export default function () {
14+
const url = http.get("https://timetracker-api.azurewebsites.net");
15+
let passed = check(url, {
16+
"status is 200": (r) => r.status === 200,
17+
});
18+
if (!passed) {
19+
errorRate.add(1);
20+
}
21+
}
22+
23+
export function handleSummary(data) {
24+
console.log("Preparing the end-of-test summary...");
25+
return {
26+
stdout: textSummary(data, { indent: " ", enableColors: true }),
27+
"summary.json": JSON.stringify(data),
28+
};
29+
}

0 commit comments

Comments
 (0)