template-monorepo/test/k6/smoke/health.js

22 lines
557 B
JavaScript
Raw Normal View History

2026-05-26 06:05:33 +00:00
// smoke: GET /api/v1/health
// Covers: normal.PingData health endpoint.
import { get, checkEnvelope } from '../lib/http.js';
export const options = {
vus: 1,
iterations: 1,
thresholds: {
checks: ['rate==1.0'],
http_req_failed: ['rate==0.0'],
http_req_duration: ['p(95)<500'],
},
};
export default function () {
const res = get('/api/v1/health');
const body = checkEnvelope(res, 'GET /api/v1/health');
if (!body || !body.data || typeof body.data.pong !== 'string') {
throw new Error(`unexpected payload: ${res.body}`);
}
}