-
Notifications
You must be signed in to change notification settings - Fork 338
Expand file tree
/
Copy pathk6.js
More file actions
61 lines (55 loc) · 1.35 KB
/
k6.js
File metadata and controls
61 lines (55 loc) · 1.35 KB
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
import http from 'k6/http';
import {checkResponse, isOk} from "../../utils/k6.js";
const variants = {
"no_agent": {
"APP_URL": 'http://localhost:8080',
},
"tracing": {
"APP_URL": 'http://localhost:8081',
},
"profiling": {
"APP_URL": 'http://localhost:8082',
},
"appsec": {
"APP_URL": 'http://localhost:8083',
},
"iast": {
"APP_URL": 'http://localhost:8084',
},
"code_origins": {
"APP_URL": 'http://localhost:8085',
}
}
export const options = function (variants) {
const scenarios = {};
for (const variant of Object.keys(variants)) {
scenarios[`load--petclinic--${variant}--warmup`] = {
executor: 'constant-vus', // https://grafana.com/docs/k6/latest/using-k6/scenarios/executors/#all-executors
vus: 5,
duration: '20s',
gracefulStop: '2s',
env: {
"APP_URL": variants[variant]["APP_URL"]
}
};
scenarios[`load--petclinic--${variant}--high_load`] = {
executor: 'constant-vus',
vus: 5,
startTime: '22s',
duration: '15s',
gracefulStop: '2s',
env: {
"APP_URL": variants[variant]["APP_URL"]
}
};
}
return {
discardResponseBodies: true,
scenarios,
}
}(variants);
export default function () {
// find owner
const ownersList = http.get(`${__ENV.APP_URL}/owners?lastName=`);
checkResponse(ownersList, isOk);
}