Skip to content

[Test] Health-probe timeout test never verifies recordProbeTimeout was called (false positive) #168

@kianwoon

Description

@kianwoon

Description

The test "calls recordProbeTimeout when probe times out" sets up a fetchMock that never resolves, then races mgr.tick() against a 100ms timeout. After the race, it calls mgr.stop() but never asserts that recordProbeTimeout was actually called.

Worse: PROBE_TIMEOUT_MS in the source is 5000ms, so the probe's internal timeout never fires in the 100ms race window. recordProbeTimeout is genuinely never called — the test is a false positive.

Location

  • tests/health-probe.test.ts:40-63
  • src/health-probe.ts:5 (PROBE_TIMEOUT_MS = 5000)

Suggested Fix

Either:

  1. Reduce PROBE_TIMEOUT_MS via dependency injection for testing
  2. Mock the internal timer
  3. At minimum, add expect(recordProbeTimeout).toHaveBeenCalled() to expose the gap

Severity

Critical — false positive test gives false confidence in health probe timeout handling

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions