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 <ville@vesilehto.fi>
This commit is contained in:
Ville Vesilehto
2025-09-16 00:28:26 +03:00
committed by GitHub
parent 55b4e9f9cd
commit 3c950b8552

View File

@@ -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{})