From 2b920ad19999e23f1c907a0371a4eeafb1031b37 Mon Sep 17 00:00:00 2001 From: Daniel Nephin Date: Thu, 13 Aug 2020 18:03:04 -0400 Subject: [PATCH] testing: fix flaky test TestDNS_NonExistentDC_RPC I saw this test flake locally, and it was easy to reproduce with -count=10. The failure was: 'TestAgent.dns: rpc error: error=No known Consul servers'. Waiting for the agent seems to fix it. --- agent/dns_test.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/agent/dns_test.go b/agent/dns_test.go index a5aa787c4b..07c4211871 100644 --- a/agent/dns_test.go +++ b/agent/dns_test.go @@ -5829,16 +5829,12 @@ func TestDNS_NonExistentDC_RPC(t *testing.T) { server = false `) defer c.Shutdown() - testrpc.WaitForLeader(t, s.RPC, "dc1") // Join LAN cluster addr := fmt.Sprintf("127.0.0.1:%d", s.Config.SerfPortLAN) _, err := c.JoinLAN([]string{addr}) require.NoError(t, err) - retry.Run(t, func(r *retry.R) { - require.Len(r, s.LANMembers(), 2) - require.Len(r, c.LANMembers(), 2) - }) + testrpc.WaitForTestAgent(t, c.RPC, "dc1") m := new(dns.Msg) m.SetQuestion("consul.service.dc2.consul.", dns.TypeANY)