forked from grafana/xk6-dashboard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
69 lines (62 loc) · 1.66 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// SPDX-FileCopyrightText: 2023 Raintank, Inc. dba Grafana Labs
//
// SPDX-License-Identifier: AGPL-3.0-only
import http from "k6/http";
import { sleep, group } from "k6";
export let options = {
discardResponseBodies: true,
scenarios: {
camel: {
executor: "ramping-vus",
startVUs: 1,
stages: [
{ duration: "1m", target: 2 },
{ duration: "3m", target: 5 },
{ duration: "2m", target: 2 },
{ duration: "3m", target: 5 },
{ duration: "2m", target: 3 },
{ duration: "1m", target: 1 },
],
gracefulRampDown: "0s",
},
snake: {
executor: "ramping-vus",
startVUs: 1,
stages: [
{ duration: "1m", target: 1 },
{ duration: "1m", target: 4 },
{ duration: "1m", target: 1 },
{ duration: "1m", target: 4 },
{ duration: "1m", target: 1 },
{ duration: "1m", target: 4 },
{ duration: "1m", target: 1 },
{ duration: "1m", target: 4 },
{ duration: "1m", target: 1 },
{ duration: "1m", target: 4 },
{ duration: "1m", target: 1 },
{ duration: "1m", target: 1 },
],
gracefulRampDown: "0s",
},
},
thresholds: {
http_req_duration: ["p(90) < 400"],
iteration_duration: ["avg < 10000"],
},
};
export default function () {
group("main", () => {
http.get("https://test-api.k6.io");
});
sleep(0.2);
group("list", () => {
http.get("https://test-api.k6.io/public/crocodiles/");
});
sleep(0.2);
group("crocodiles", () => {
for (var i = 0; i < 5; i++) {
http.get(http.url`https://test-api.k6.io/public/crocodiles/${i}/`);
sleep(0.5);
}
});
}