42 lines
1.0 KiB
JavaScript
42 lines
1.0 KiB
JavaScript
import http from 'k6/http';
|
|
import { check, sleep } from 'k6';
|
|
|
|
/**
|
|
* Suite de humo ligero del gateway (PROFILE=shared8g).
|
|
*
|
|
* k6 run -e BASE_URL=http://127.0.0.1:8189 -e PROFILE=shared8g k6_smoke_suite.js
|
|
*/
|
|
const PROFILE = __ENV.PROFILE || 'shared8g';
|
|
const BASE_URL = __ENV.BASE_URL || 'http://127.0.0.1:8189';
|
|
|
|
export const options = {
|
|
vus: PROFILE === 'lab' ? 5 : 2,
|
|
duration: PROFILE === 'lab' ? '60s' : '30s',
|
|
thresholds: {
|
|
http_req_failed: ['rate<0.05'],
|
|
http_req_duration: ['p(95)<2000'],
|
|
checks: ['rate>0.9'],
|
|
},
|
|
tags: { profile: PROFILE, suite: 'smoke' },
|
|
};
|
|
|
|
export default function () {
|
|
const live = http.get(`${BASE_URL}/health/live`);
|
|
check(live, {
|
|
'live 200': (r) => r.status === 200,
|
|
});
|
|
|
|
const health = http.get(`${BASE_URL}/health`);
|
|
check(health, {
|
|
'health 200': (r) => r.status === 200,
|
|
'health body ok': (r) => String(r.body).includes('"ok"'),
|
|
});
|
|
|
|
const config = http.get(`${BASE_URL}/config`);
|
|
check(config, {
|
|
'config not 5xx': (r) => r.status < 500,
|
|
});
|
|
|
|
sleep(0.5);
|
|
}
|