Summary
The K6 stress test records a boolean (1 or 0) into a metric that is supposed to measure HTTP duration in milliseconds. The p(95) < 2000ms threshold is completely meaningless.
Affected File
tests/performance/k6-stress.js:45
Root Cause
const loginDuration = new Trend('login_duration');
// In setup():
loginDuration.add(token ? 1 : 0); // Records boolean, not HTTP duration!
The loginDuration trend is supposed to track how long the login HTTP request takes. Instead of recording the actual request duration, it records 1 if a token was obtained or 0 if not. The threshold check loginDuration.p(95) < 2000 will always pass because 1 < 2000.
The same issue exists in the smoke test (k6-smoke.js:37):
errorRate.add(!ok); // Boolean instead of 0/1
Impact
- Performance thresholds are completely meaningless
- The login endpoint could take 30 seconds and still pass all thresholds
- False confidence in system performance
- Performance regression goes undetected
Fix Required
Record the actual HTTP request duration:
const loginResp = http.post(`${AUTH_URL}/auth/login`, ...);
loginDuration.add(loginResp.timings.duration);
For the error rate:
errorRate.add(ok ? 0 : 1);
Summary
The K6 stress test records a boolean (1 or 0) into a metric that is supposed to measure HTTP duration in milliseconds. The
p(95) < 2000msthreshold is completely meaningless.Affected File
tests/performance/k6-stress.js:45Root Cause
The
loginDurationtrend is supposed to track how long the login HTTP request takes. Instead of recording the actual request duration, it records1if a token was obtained or0if not. The threshold checkloginDuration.p(95) < 2000will always pass because1 < 2000.The same issue exists in the smoke test (
k6-smoke.js:37):Impact
Fix Required
Record the actual HTTP request duration:
For the error rate: