@marcel91200 / caddy Mirror · read-only / commits / abde11bc
Fork 0

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS

Mirrored from https://github.com/Slazee/caddy.git

Synced Nov 11, 01:00 UTC

tests: stabilise HTTP/2 idle timeout test (#8351)

Zen Dodd committed Nov 5, 2026 at 19:10 UTC abde11bc1f2df74e4fb9bccefcf2462db6fe54f0
1 file changed +5 -1
modules/caddyhttp/idletimeout_test.go
+5 -1
@@ -1202,6 +1202,7 @@ func TestIdleTimeoutReaderOverrideSuspendsMinRate(t *testing.T) {
1202 // when it fires, even with no read in flight. The client isn't stalled:
1203 // it's held back by flow control while the handler isn't reading.
1204 func TestIdleTimeoutReaderPausedHandlerHTTP2(t *testing.T) {
1205 + const startupIdle = 5 * time.Second
1206 const idle = 100 * time.Millisecond
1207 const pause = 300 * time.Millisecond
1208 const size = 4 << 20 // more than the HTTP/2 flow control window
@@ -1210,7 +1211,7 @@ func TestIdleTimeoutReaderPausedHandlerHTTP2(t *testing.T) {
1211 reader := &IdleTimeoutReader{
1212 ReadCloser: r.Body,
1213 Ctrl: http.NewResponseController(w),
1213 - Deadline: IdleDeadline{Start: time.Now(), Timeout: idle},
1214 + Deadline: IdleDeadline{Start: time.Now(), Timeout: startupIdle},
1215 Logger: zap.NewNop(),
1216 ClearBetweenReads: r.ProtoMajor == 2,
1217 }
@@ -1220,6 +1221,9 @@ func TestIdleTimeoutReaderPausedHandlerHTTP2(t *testing.T) {
1221 http.Error(w, err.Error(), http.StatusBadRequest)
1222 return
1223 }
1224 + // Override re-arms the short deadline if the first read failed to release it.
1225 + restore := reader.Override(idle, 0)
1226 + defer restore()
1227 time.Sleep(pause)
1228 n, err := io.Copy(io.Discard, reader)
1229 if err != nil {