-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathload-test.js
More file actions
38 lines (33 loc) · 877 Bytes
/
Copy pathload-test.js
File metadata and controls
38 lines (33 loc) · 877 Bytes
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
import http from 'k6/http';
import { sleep } from 'k6';
export let options = {
stages: [
{ duration: '30s', target: 100 },
{ duration: '30s', target: 300 },
{ duration: '30s', target: 600 },
{ duration: '30s', target: 1000 },
{ duration: '30s', target: 0 },
],
};
export function setup() {
let res = http.post(
'http://host.docker.internal:8081/auth/login',
JSON.stringify({
email: "test12@gmail.com",
password: "test1234"
}),
{ headers: { 'Content-Type': 'application/json' } }
);
return { token: res.json('data') };
}
export default function (data) {
http.get(
'http://host.docker.internal:8081/post/user/1',
{
headers: {
Authorization: `Bearer ${data.token}`
}
}
);
sleep(1);
}