Wait for agent joins to finish in TestClient_RPC

This commit is contained in:
Kyle Havlovitz 2016-10-25 17:28:45 -07:00
parent 114ee0755a
commit f0aa65754b

View file

@ -343,17 +343,16 @@ func TestClient_RPC_TLS(t *testing.T) {
t.Fatalf("err: %v", err)
}
// Check the members
// Wait for joins to finish/RPC to succeed
testutil.WaitForResult(func() (bool, error) {
if len(s1.LANMembers()) != 2 {
t.Fatalf("bad len")
return false, fmt.Errorf("bad len: %v", len(s1.LANMembers()))
}
if len(c1.LANMembers()) != 2 {
t.Fatalf("bad len")
return false, fmt.Errorf("bad len: %v", len(c1.LANMembers()))
}
// RPC should succeed
testutil.WaitForResult(func() (bool, error) {
err := c1.RPC("Status.Ping", struct{}{}, &out)
return err == nil, err
}, func(err error) {