Skip to content

Commit cb9e3da

Browse files
authored
test(hotreload): increase caddytest's Client.Timeout (#2431)
## 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.
1 parent 5860768 commit cb9e3da

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

caddy/hotreload_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"strings"
1212
"sync"
1313
"testing"
14+
"time"
1415

1516
"github.com/caddyserver/caddy/v2/caddytest"
1617
"github.com/stretchr/testify/require"
@@ -25,6 +26,10 @@ func TestHotReload(t *testing.T) {
2526
indexFile := filepath.Join(tmpDir, "index.php")
2627

2728
tester := caddytest.NewTester(t)
29+
// caddytest's default 5s http.Client.Timeout is too tight for the
30+
// SSE roundtrip below on slow CI runners (notably emulated armv7).
31+
// 30s keeps the test bounded so a real regression fails fast.
32+
tester.Client.Timeout = 30 * time.Second
2833
tester.InitServer(`
2934
{
3035
debug

0 commit comments

Comments
 (0)