From ac346e03e27694d36bb1bafd59daa3beeb9f118d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Sat, 16 May 2026 15:47:04 +0200 Subject: [PATCH 1/2] test(hotreload): drop caddytest's 5s Client.Timeout 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: php#2430 arm/v7 job 76318473726 --- caddy/hotreload_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/caddy/hotreload_test.go b/caddy/hotreload_test.go index c3d8cb5b22..4d6fddb127 100644 --- a/caddy/hotreload_test.go +++ b/caddy/hotreload_test.go @@ -25,6 +25,10 @@ func TestHotReload(t *testing.T) { indexFile := filepath.Join(tmpDir, "index.php") tester := caddytest.NewTester(t) + // The SSE roundtrip below can exceed caddytest's default 5s + // http.Client.Timeout on slow CI runners (notably emulated armv7). + // Cancellation via the request context terminates the read instead. + tester.Client.Timeout = 0 tester.InitServer(` { debug From 7ac9ae09278e87950a461523d799f7754846411e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Sat, 16 May 2026 16:38:41 +0200 Subject: [PATCH 2/2] test(hotreload): use 30s timeout instead of disabling it Addresses Copilot's review on https://github.com/php/frankenphp/pull/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. --- caddy/hotreload_test.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/caddy/hotreload_test.go b/caddy/hotreload_test.go index 4d6fddb127..a7d0cef8ab 100644 --- a/caddy/hotreload_test.go +++ b/caddy/hotreload_test.go @@ -11,6 +11,7 @@ import ( "strings" "sync" "testing" + "time" "github.com/caddyserver/caddy/v2/caddytest" "github.com/stretchr/testify/require" @@ -25,10 +26,10 @@ func TestHotReload(t *testing.T) { indexFile := filepath.Join(tmpDir, "index.php") tester := caddytest.NewTester(t) - // The SSE roundtrip below can exceed caddytest's default 5s - // http.Client.Timeout on slow CI runners (notably emulated armv7). - // Cancellation via the request context terminates the read instead. - tester.Client.Timeout = 0 + // caddytest's default 5s http.Client.Timeout is too tight for the + // SSE roundtrip below on slow CI runners (notably emulated armv7). + // 30s keeps the test bounded so a real regression fails fast. + tester.Client.Timeout = 30 * time.Second tester.InitServer(` { debug