-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
36 lines (28 loc) · 876 Bytes
/
Copy pathtest.js
File metadata and controls
36 lines (28 loc) · 876 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
import http from "k6/http";
import { check, sleep } from "k6";
export const options = {
vus: 1000,
duration: "30s",
};
export default function () {
const url = "http://localhost:8085/api/queue/in";
// __VU를 사용하여 1~1000 사이의 고유 ID 생성
const userId = __VU;
const payload = JSON.stringify({
performanceId: 1,
optionId: 1,
});
const params = {
headers: {
"X-User-Id": userId.toString(), // 문자열로 변환하여 전달
"Content-Type": "application/json",
},
};
const res = http.post(url, payload, params);
check(res, {
"is status 200": (r) => r.status === 200,
"transaction time < 500ms": (r) => r.timings.duration < 500,
});
// 초당 100명 발급 로직을 테스트하려면 sleep 조절이 필요함
sleep(30);
}