aded k6 and script and updated code with better logic and indexing on schema
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
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,
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user