Skip to content

HIGH: K6 stress test records boolean instead of HTTP duration - thresholds meaningless #50

@Senthil455

Description

@Senthil455

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);

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghighHigh severity

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions