import http from 'k6/http' import { check, sleep } from 'k6' export const options = { vus: 20, duration: '30s', thresholds: { http_req_failed: ['rate<0.01'], http_req_duration: ['p(95)<1500'] } } const baseUrl = __ENV.BASE_URL || 'http://localhost:8080' export default function () { const res = http.post(`${baseUrl}/api/v1/auth/login`, JSON.stringify({ username: 'sys_admin', password: 'ChangeMe123!', deviceName: 'k6' }), { headers: { 'Content-Type': 'application/json' } }) check(res, { 'login ok': (r) => r.status === 200 }) sleep(1) }