Skip to content

test(hotreload): drop caddytest's 5s Client.Timeout#2431

Merged
dunglas merged 2 commits into
mainfrom
fix/hotreload-test-timeout
May 16, 2026
Merged

test(hotreload): drop caddytest's 5s Client.Timeout#2431
dunglas merged 2 commits into
mainfrom
fix/hotreload-test-timeout

Conversation

@dunglas
Copy link
Copy Markdown
Member

@dunglas dunglas commented May 16, 2026

Root cause

TestHotReload was failing on https://github.com/php/frankenphp/actions/runs/25961840516/job/76318473726 (linux/arm/v7, dispatched from #2430) with:

context deadline exceeded (Client.Timeout or context cancellation while reading body)

caddytest.NewTester initialises tester.Client.Timeout = 5s (Default.TestRequestTimeout). That budget covers the entire roundtrip including body reads. On an emulated armv7 runner the chain os.WriteFile → e-dant/watcher event → mercure publish → SSE chunk delivery doesn't complete in 5 s, so the streaming resp.Body.Read is killed before the marker index.php is seen. The job died at exactly 5.03 s.

Fix

Set tester.Client.Timeout = 0 for this test. The test already cancels the read via context.WithCancel once the marker appears in the buffer, and Go's -timeout provides the outer deadline — the 5 s inner cap was redundant.

The other failing job on that run (linux/amd64, e-dant/watcher cmake build) is unrelated to this PR.

caddytest's NewTester sets http.Client.Timeout to 5s by default. On
slow CI runners (notably emulated linux/arm/v7) the SSE roundtrip
"watcher fires -> mercure publishes -> client receives" can exceed
that budget and the test dies with "context deadline exceeded
(Client.Timeout or context cancellation while reading body)".

The test already terminates the streaming read via context.WithCancel
once "index.php" appears in the buffer, and the Go test harness
provides the outer deadline. Setting Client.Timeout to 0 removes the
redundant inner deadline.

Flaky run that prompted this: #2430 arm/v7 job 76318473726
Copilot AI review requested due to automatic review settings May 16, 2026 13:47
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses flaky CI failures in TestHotReload caused by caddytest.NewTester configuring an http.Client.Timeout of 5s, which can be too short for the SSE-based hot-reload roundtrip on slower/emulated runners.

Changes:

  • Disable caddytest’s default http.Client.Timeout within TestHotReload by setting tester.Client.Timeout = 0.
  • Add an explanatory comment documenting why the timeout is disabled for this test.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread caddy/hotreload_test.go Outdated
Addresses Copilot's review on #2431: setting Client.Timeout to 0 leaves
the test relying on Go's outer harness timeout if the SSE marker never
arrives, making real regressions slow to surface. 30s is generous
enough for emulated armv7 (the actual roundtrip there is ~5-6s) while
still bounding the failure mode.
@dunglas
Copy link
Copy Markdown
Member Author

dunglas commented May 16, 2026

Switched to a bounded 30s timeout per #2431 (comment) — keeps the test fast-failing on real regression while leaving enough headroom for emulated armv7 (~5-6s actual roundtrip).

dunglas added a commit that referenced this pull request May 16, 2026
caddytest's default 5s http.Client.Timeout covers the whole roundtrip,
including body reads. On emulated armv7 the SSE chain
(WriteFile -> e-dant/watcher -> mercure -> client) doesn't fit in 5s
and the test dies with "Client.Timeout or context cancellation while
reading body".

Bump to 30s — generous enough for the slow runners (~5-6s actual)
while keeping a bounded failure mode if the marker never arrives.
Same fix is in #2431; carrying it here so this PR's CI does not
trip on the unrelated flake.
@dunglas dunglas merged commit cb9e3da into main May 16, 2026
31 checks passed
@dunglas dunglas deleted the fix/hotreload-test-timeout branch May 16, 2026 15:11
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