Skip to content

Interrupt tests rely on wall-clock sleeps #260

Closed

Description

@TMHSDigital

Summary

Two CLI tests time their interrupt with a fixed sleep. They expect it to land in the middle of a scan, which a slow runner can miss.

Where

  • main_e2e_test.go:821-838: sleeps 1 s, then interrupts a scan expected to take about 2 s
  • main_signal_unix_test.go:27: sleeps 200 ms before SIGTERM

Impact

On a slow or loaded runner the scan finishes before the interrupt arrives, and got >= len(want) fails. This is the same class as the recent flake fixes.

Suggested fix

Trigger the interrupt from an event (for example after the Nth result line on stdout, or through the existing signalReady seam) instead of a wall-clock sleep.

Acceptance criteria

  • No time.Sleep decides when the interrupt fires in either test.

Getting started

  • Relevant files: main_e2e_test.go, main_signal_unix_test.go
  • How to run tests: go test -run 'Interrupt|Signal' -count=20 .
  • Related docs: docs/DEVELOPER_GUIDE.md

Filed by repo-audit/full-audit at 3f671b2. Severity: low. Effort: S. audit-key: testing|main_e2e_test.go|interrupt-sleep

Activity

  1. added
    good first issue
    testing
    severity: low
    on Nov 14, 2026
  2. TMHSDigital commented on Nov 14, 2026

    @TMHSDigital
    OwnerAuthor

    Fixed in 536c4b6: both tests now fire the interrupt from a stdout writer after the Nth result line (runCLIUntilLines) instead of a sleep. Verified: TestE2EResume x10 on Windows, TestE2EResume and TestE2ESIGTERMExits143 x5 on Linux (WSL), plus the root package tests and golangci-lint (windows and linux).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueseverity: lowtesting

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions