-
Notifications
You must be signed in to change notification settings - Fork 100
/
ewoks.js
28 lines (21 loc) · 827 Bytes
/
ewoks.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
import http from 'k6/http';
import { check, sleep } from "k6";
const isNumeric = (value) => /^\d+$/.test(value);
const default_vus = 5;
const target_vus_env = `${__ENV.TARGET_VUS}`;
const target_vus = isNumeric(target_vus_env) ? Number(target_vus_env) : default_vus;
export let options = {
stages: [
// Ramp-up from 1 to TARGET_VUS virtual users (VUs) in 5s
{ duration: "5s", target: target_vus },
// Stay at rest on TARGET_VUS VUs for 10s
{ duration: "10s", target: target_vus },
// Ramp-down from TARGET_VUS to 0 VUs for 5s
{ duration: "5s", target: 0 }
]
};
export default function () {
const response = http.get("https://swapi.dev/api/people/30/", {headers: {Accepts: "application/json"}});
check(response, { "status is 200": (r) => r.status === 200 });
sleep(.300);
};