Skip to content

fix: remove contradictory timing in health handler test - #263

Merged
umputun merged 1 commit into
masterfrom
fix/health-test-timing
Aug 21, 2026
Merged

fix: remove contradictory timing in health handler test#263
umputun merged 1 commit into
masterfrom
fix/health-test-timing

Conversation

@umputun

@umputun umputun commented Aug 21, 2026

Copy link
Copy Markdown
Owner

TestHttp_healthHandler has two pieces of timing that contradict each other. The server gets a 500ms context at line 67, and line 110 then waits up to a full second for that same server to answer. On a machine slow enough to take more than about 450ms to bind and serve, the context cancels the server while require.Eventually is still retrying, and the test reports "server failed to start" having actually started it. Separately, a fixed 50ms sleep stood in for discovery loading five static rules at a 10ms interval; when that is short the health check sees fewer than four services and the count assertion fails instead.

The server now gets a context that outlives the assertions, and the sleep is replaced by waiting on svc.Mappers() reaching five.

I could not reproduce the original failure red on my machine, and neither could a 40-run pass at -cpu=1 under load. Forcing the server context to expire during the wait does produce the exact observed failure, which is what the first change removes:

--- FAIL: TestHttp_healthHandler (1.05s)
        	Messages:   	server failed to start

Copilot AI lite review requested due to automatic review settings August 21, 2026 00:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@umputun
umputun merged commit e6d8b8c into master Aug 21, 2026
4 checks passed
@umputun
umputun deleted the fix/health-test-timing branch August 21, 2026 00:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants