-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstress.js
34 lines (30 loc) · 950 Bytes
/
stress.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
29
30
31
32
33
34
import http from 'k6/http';
import { check, sleep, Rate } from "k6";
//Random Selection from last 10th of the DB
let max = 1000011;
let min = 900000;
const productId = Math.floor(Math.random() * (max - min) + min);
// Define the base URL of the API Routes
const allProductsroute = `http://localhost:9999/products/`;
const productRequest = `http://localhost:9999/products/${productId}`;
const styleRequest = `http://localhost:9999/products/${productId}/styles`;
const relatedRoute = `http://localhost:9999/products/${productId}/related`;
export const options = {
discardResponseBodies: true,
scenarios: {
contacts: {
executor: 'constant-arrival-rate',
duration: '30s',
rate: 1000,
timeUnit: '1s',
preAllocatedVUs: 2,
maxVUs: 50000,
},
},
};
export default function () {
let response = http.get(`${relatedRoute}`, options);
check(response, {
"status is 200": (r) => r.status === 200
});
}