From 58daa2f7888e36c1577645601977c44c02dbdfd7 Mon Sep 17 00:00:00 2001 From: AkinoKaede Date: Mon, 22 Mar 2021 13:20:14 +0800 Subject: [PATCH] fix: DNS tests timeout due to network instability --- app/dns/nameserver_local_test.go | 2 +- app/dns/nameserver_quic_test.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/dns/nameserver_local_test.go b/app/dns/nameserver_local_test.go index f9142109..d1995a63 100644 --- a/app/dns/nameserver_local_test.go +++ b/app/dns/nameserver_local_test.go @@ -13,7 +13,7 @@ import ( func TestLocalNameServer(t *testing.T) { s := NewLocalNameServer() - ctx, cancel := context.WithTimeout(context.Background(), time.Second*2) + ctx, cancel := context.WithTimeout(context.Background(), time.Second*5) ips, err := s.QueryIP(ctx, "google.com", net.IP{}, dns.IPOption{ IPv4Enable: true, IPv6Enable: true, diff --git a/app/dns/nameserver_quic_test.go b/app/dns/nameserver_quic_test.go index de3ef6f9..5a4beba9 100644 --- a/app/dns/nameserver_quic_test.go +++ b/app/dns/nameserver_quic_test.go @@ -19,7 +19,7 @@ func TestQUICNameServer(t *testing.T) { common.Must(err) s, err := NewQUICNameServer(url) common.Must(err) - ctx, cancel := context.WithTimeout(context.Background(), time.Second*2) + ctx, cancel := context.WithTimeout(context.Background(), time.Second*5) ips, err := s.QueryIP(ctx, "google.com", net.IP(nil), dns_feature.IPOption{ IPv4Enable: true, IPv6Enable: true, @@ -36,7 +36,7 @@ func TestQUICNameServerWithCache(t *testing.T) { common.Must(err) s, err := NewQUICNameServer(url) common.Must(err) - ctx, cancel := context.WithTimeout(context.Background(), time.Second*2) + ctx, cancel := context.WithTimeout(context.Background(), time.Second*5) ips, err := s.QueryIP(ctx, "google.com", net.IP(nil), dns_feature.IPOption{ IPv4Enable: true, IPv6Enable: true, @@ -47,7 +47,7 @@ func TestQUICNameServerWithCache(t *testing.T) { t.Error("expect some ips, but got 0") } - ctx2, cancel := context.WithTimeout(context.Background(), time.Second*2) + ctx2, cancel := context.WithTimeout(context.Background(), time.Second*5) ips2, err := s.QueryIP(ctx2, "google.com", net.IP(nil), dns_feature.IPOption{ IPv4Enable: true, IPv6Enable: true,