38 lines
889 B
JavaScript
38 lines
889 B
JavaScript
import http from 'k6/http';
|
|
import { check } from 'k6';
|
|
|
|
const BASE_URL = __ENV.BASE_URL || 'http://app:3000';
|
|
|
|
export const options = {
|
|
stages: [
|
|
{ duration: '20s', target: 5 },
|
|
{ duration: '20s', target: 10 },
|
|
{ duration: '20s', target: 20 },
|
|
{ duration: '20s', target: 30 },
|
|
{ duration: '20s', target: 40 },
|
|
{ duration: '20s', target: 50 },
|
|
{ duration: '15s', target: 0 },
|
|
],
|
|
thresholds: {
|
|
http_req_failed: ['rate<0.01'],
|
|
http_req_duration: ['p(95)<500'],
|
|
checks: ['rate>0.99'],
|
|
},
|
|
};
|
|
|
|
export default function () {
|
|
const endpoints = [
|
|
'/users/',
|
|
'/teachers/',
|
|
'/sessions/available?dateTimestamp=2026-10-25T10%3A00%3A00.000Z',
|
|
];
|
|
|
|
for (const endpoint of endpoints) {
|
|
const response = http.get(`${BASE_URL}${endpoint}`);
|
|
|
|
check(response, {
|
|
[`${endpoint}: status 200`]: (r) => r.status === 200,
|
|
});
|
|
}
|
|
}
|