-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathk6.js
More file actions
48 lines (45 loc) · 1.68 KB
/
k6.js
File metadata and controls
48 lines (45 loc) · 1.68 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
/* eslint-disable import/prefer-default-export */
import http from 'k6/http';
import { check, sleep } from 'k6';
export const options = {
stages: [
// { duration: '30s', target: 200 },
// { duration: '30s', target: 400 },
// { duration: '1m30s', target: 600 },
// { duration: '1m30s', target: 500 },
// { duration: '30s', target: 800 },
// { duration: '1m30s', target: 900 },
// { duration: '1m30s', target: 800 },
// { duration: '1m30s', target: 700 },
// { duration: '1m30s', target: 500 },
// { duration: '1m30s', target: 300 },
// { duration: '1m30s', target: 100 },
// { duration: '1m', target: 0 },
{ duration: '1m', target: 200 },
{ duration: '2m', target: 200 },
{ duration: '1m', target: 400 },
{ duration: '2m', target: 400 },
{ duration: '1m', target: 500 },
{ duration: '2m', target: 500 },
{ duration: '1m', target: 600 },
{ duration: '2m', target: 600 },
{ duration: '1m30s', target: 800 },
{ duration: '3m', target: 800 },
{ duration: '2m', target: 1000 },
{ duration: '4m', target: 1000 },
{ duration: '2m', target: 1200 },
{ duration: '5m', target: 1200 },
{ duration: '2m', target: 1400 },
{ duration: '5m', target: 1400 },
{ duration: '8m', target: 0 },
],
};
let randNum = () => Math.floor(Math.random() * 10000000) + 1;
export default function () {
const res = http.get(`http://localhost:8004/api/seller/${randNum()}`);
check(res, { 'status was 200 for getseller': (r) => r.status === 200 });
sleep(1);
// const res2 = http.get(`http://localhost:8004/api/store/${randNum()}`);
// check(res2, { 'status was 200 for getstore': (r) => r.status === 200 });
// sleep(1);
};