Skip to content

fix(tests): wait for listener readiness in TestWorkerWithInactiveWatcher - #2528

Merged
dunglas merged 1 commit into
mainfrom
fix/watcher-test-flakiness
Jul 18, 2026
Merged

fix(tests): wait for listener readiness in TestWorkerWithInactiveWatcher#2528
dunglas merged 1 commit into
mainfrom
fix/watcher-test-flakiness

Conversation

@dunglas

@dunglas dunglas commented Jul 18, 2026

Copy link
Copy Markdown
Member

`TestWorkerWithInactiveWatcher` calls `tester.InitServer` and immediately asserts against the app endpoint. `caddytest`'s own readiness check only polls the admin API, not the app-facing listener, so under load a request can land in the gap and get an EOF (seen in CI: https://github.com/php/frankenphp/actions/runs/29648714936/job/88091254601).

The existing `initServer` helper in this package works around a similar race, but it polls via a real HTTP GET, which isn't usable here since this test asserts an exact worker request counter starting at 1.

Adds `waitForListener`, which polls a raw TCP dial/close (no HTTP, no counter impact) until the listener accepts connections, before the counted requests.

Verified with repeated full-suite runs locally.

Copilot AI review requested due to automatic review settings July 18, 2026 15:42

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.

@dunglas
dunglas merged commit e8d987c into main Jul 18, 2026
32 checks passed
@dunglas
dunglas deleted the fix/watcher-test-flakiness branch July 18, 2026 15:46
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