From 3c950b8552b1e877d6fe2fcd917a2bcc7d776de5 Mon Sep 17 00:00:00 2001 From: Ville Vesilehto Date: Tue, 16 Sep 2025 00:28:26 +0300 Subject: [PATCH] fix(forward): deflake TestFailover (#7558) In CI, the first two upstream attempts can stall on UDP and each consume the default 2s read timeout. Possibly exhausting most of the 5s forward deadline before the healthy third upstream is tried. Lower the read timeout to make retries faster. Signed-off-by: Ville Vesilehto --- plugin/forward/setup_test.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/plugin/forward/setup_test.go b/plugin/forward/setup_test.go index 6a885b3d8..5d76b954b 100644 --- a/plugin/forward/setup_test.go +++ b/plugin/forward/setup_test.go @@ -7,6 +7,7 @@ import ( "reflect" "strings" "testing" + "time" "github.com/coredns/caddy" "github.com/coredns/coredns/core/dnsserver" @@ -483,6 +484,12 @@ func TestFailover(t *testing.T) { f.OnStartup() defer f.OnShutdown() + // Reduce per-upstream read timeout to make the test fit within the + // per-query deadline defaultTimeout of 5 seconds. + for _, p := range f.proxies { + p.SetReadTimeout(500 * time.Millisecond) + } + m := new(dns.Msg) m.SetQuestion("example.org.", dns.TypeA) rec := dnstest.NewRecorder(&test.ResponseWriter{})