32 lines
919 B
JavaScript
32 lines
919 B
JavaScript
// k6 equivalent of FailingAssertionSimulation: 220 requests/s against ~160/s of capacity,
|
|
// with thresholds that cannot hold. k6 exits with code 99 when a threshold fails.
|
|
import http from 'k6/http';
|
|
import { SharedArray } from 'k6/data';
|
|
|
|
const BASE = __ENV.APP_URL || 'http://localhost:18300';
|
|
const symbols = new SharedArray('symbols', () =>
|
|
open('../src/test/resources/data/symbols.csv').trim().split('\n').slice(1));
|
|
|
|
http.setResponseCallback(http.expectedStatuses(200));
|
|
|
|
export const options = {
|
|
scenarios: {
|
|
overload: {
|
|
executor: 'constant-arrival-rate',
|
|
rate: 220,
|
|
timeUnit: '1s',
|
|
duration: '15s',
|
|
preAllocatedVUs: 200,
|
|
maxVUs: 1000,
|
|
},
|
|
},
|
|
thresholds: {
|
|
http_req_duration: ['p(95)<200'],
|
|
http_req_failed: ['rate<0.01'],
|
|
},
|
|
};
|
|
|
|
export default function () {
|
|
http.get(`${BASE}/api/quote/${symbols[Math.floor(Math.random() * symbols.length)]}`);
|
|
}
|