diff --git a/agent/consul/catalog_endpoint_test.go b/agent/consul/catalog_endpoint_test.go index a44a9e4776..24e9a9e0e4 100644 --- a/agent/consul/catalog_endpoint_test.go +++ b/agent/consul/catalog_endpoint_test.go @@ -165,11 +165,10 @@ func TestCatalog_Register_ACLDeny(t *testing.T) { }) defer os.RemoveAll(dir1) defer s1.Shutdown() + testrpc.WaitForTestAgent(t, s1.RPC, "dc1") codec := rpcClient(t, s1) defer codec.Close() - testrpc.WaitForLeader(t, s1.RPC, "dc1") - // Create the ACL. arg := structs.ACLRequest{ Datacenter: "dc1", diff --git a/agent/consul/leader_test.go b/agent/consul/leader_test.go index c56477abf1..fdcf9dfd73 100644 --- a/agent/consul/leader_test.go +++ b/agent/consul/leader_test.go @@ -290,6 +290,8 @@ func TestLeader_ReapServer(t *testing.T) { joinLAN(t, s1, s3) testrpc.WaitForLeader(t, s1.RPC, "dc1") + testrpc.WaitForLeader(t, s2.RPC, "dc1") + testrpc.WaitForLeader(t, s3.RPC, "dc1") state := s1.fsm.State() // s3 should be registered @@ -888,6 +890,7 @@ func TestLeader_ChangeServerID(t *testing.T) { joinLAN(t, s2, s1) joinLAN(t, s3, s1) for _, s := range servers { + testrpc.WaitForTestAgent(t, s.RPC, "dc1") retry.Run(t, func(r *retry.R) { r.Check(wantPeers(s, 3)) }) } diff --git a/agent/consul/rtt_test.go b/agent/consul/rtt_test.go index 7a56971f2e..fa5f60538d 100644 --- a/agent/consul/rtt_test.go +++ b/agent/consul/rtt_test.go @@ -238,10 +238,10 @@ func TestRTT_sortNodesByDistanceFrom_ServiceNodes(t *testing.T) { dir, server := testServer(t) defer os.RemoveAll(dir) defer server.Shutdown() + testrpc.WaitForTestAgent(t, server.RPC, "dc1") codec := rpcClient(t, server) defer codec.Close() - testrpc.WaitForLeader(t, server.RPC, "dc1") seedCoordinates(t, codec, server) nodes := structs.ServiceNodes{ diff --git a/agent/consul/session_endpoint_test.go b/agent/consul/session_endpoint_test.go index a11699abce..e66281a195 100644 --- a/agent/consul/session_endpoint_test.go +++ b/agent/consul/session_endpoint_test.go @@ -501,11 +501,10 @@ func TestSession_ApplyTimers(t *testing.T) { dir1, s1 := testServer(t) defer os.RemoveAll(dir1) defer s1.Shutdown() + testrpc.WaitForTestAgent(t, s1.RPC, "dc1") codec := rpcClient(t, s1) defer codec.Close() - testrpc.WaitForLeader(t, s1.RPC, "dc1") - s1.fsm.State().EnsureNode(1, &structs.Node{Node: "foo", Address: "127.0.0.1"}) arg := structs.SessionRequest{ Datacenter: "dc1", @@ -549,11 +548,10 @@ func TestSession_Renew(t *testing.T) { }) defer os.RemoveAll(dir1) defer s1.Shutdown() + testrpc.WaitForTestAgent(t, s1.RPC, "dc1") codec := rpcClient(t, s1) defer codec.Close() - testrpc.WaitForLeader(t, s1.RPC, "dc1") - s1.fsm.State().EnsureNode(1, &structs.Node{Node: "foo", Address: "127.0.0.1"}) ids := []string{} for i := 0; i < 5; i++ { @@ -713,11 +711,10 @@ func TestSession_Renew_ACLDeny(t *testing.T) { }) defer os.RemoveAll(dir1) defer s1.Shutdown() + testrpc.WaitForTestAgent(t, s1.RPC, "dc1") codec := rpcClient(t, s1) defer codec.Close() - testrpc.WaitForLeader(t, s1.RPC, "dc1") - // Create the ACL. req := structs.ACLRequest{ Datacenter: "dc1", diff --git a/agent/consul/snapshot_endpoint_test.go b/agent/consul/snapshot_endpoint_test.go index 9cb12e970d..b3243a05a3 100644 --- a/agent/consul/snapshot_endpoint_test.go +++ b/agent/consul/snapshot_endpoint_test.go @@ -311,11 +311,11 @@ func TestSnapshot_Forward_Leader(t *testing.T) { }) defer os.RemoveAll(dir2) defer s2.Shutdown() + testrpc.WaitForTestAgent(t, s1.RPC, "dc1") // Try to join. joinLAN(t, s2, s1) - testrpc.WaitForLeader(t, s1.RPC, "dc1") - testrpc.WaitForLeader(t, s2.RPC, "dc1") + testrpc.WaitForTestAgent(t, s2.RPC, "dc1") // Run against the leader and the follower to ensure we forward. When // we changed to Raft protocol version 3, since we only have two servers,