-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstress-load.js
More file actions
27 lines (22 loc) · 802 Bytes
/
stress-load.js
File metadata and controls
27 lines (22 loc) · 802 Bytes
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
import http from 'k6/http';
import { check, sleep } from 'k6';
// Configuración de la carga: Simulamos usuarios llegando
export const options = {
stages: [
{ duration: '10s', target: 20 }, // Calentamiento: subir a 20 usuarios
{ duration: '30s', target: 50 }, // Carga: mantener 50 usuarios concurrentes
{ duration: '10s', target: 0 }, // Enfriamiento
],
};
export default function () {
// ATENCIÓN: Usamos la IP dinámica de tu WSL y el puerto de Fabio (9999)
const ip = '172.25.212.178';
const port = '9999';
const res = http.get(`http://${ip}:${port}/api/hello`);
// Validamos que responda 200 OK y que el JSON tenga contenido
check(res, {
'status is 200': (r) => r.status === 200,
'node ID present': (r) => r.body.includes('node'),
});
sleep(1);
}