Revert "Remove `WaitForResult` from two failing tests"

This reverts commit f0842409cde194ce2102ff2baf3de821cb6ac9d5.
This commit is contained in:
William Tisäter 2014-05-26 23:49:23 +02:00
parent 93e89b8148
commit 0ddc86bbcc
2 changed files with 16 additions and 12 deletions

View File

@ -173,10 +173,11 @@ func TestClient_RPC_TLS(t *testing.T) {
t.Fatalf("bad len") t.Fatalf("bad len")
} }
time.Sleep(100 * time.Millisecond)
// RPC should succeed // RPC should succeed
if err := c1.RPC("Status.Ping", struct{}{}, &out); err != nil { testutil.WaitForResult(func() (bool, error) {
err := c1.RPC("Status.Ping", struct{}{}, &out)
return err == nil, err
}, func(err error) {
t.Fatalf("err: %v", err) t.Fatalf("err: %v", err)
} })
} }

View File

@ -291,13 +291,16 @@ func TestServer_JoinLAN_TLS(t *testing.T) {
t.Fatalf("bad len") t.Fatalf("bad len")
}) })
time.Sleep(100 * time.Millisecond)
// Verify Raft has established a peer // Verify Raft has established a peer
if s1.Stats()["raft"]["num_peers"] != "1" { testutil.WaitForResult(func() (bool, error) {
t.Fatalf("bad: %v", s1.Stats()["raft"]) return s1.Stats()["raft"]["num_peers"] == "1", nil
} }, func(err error) {
if s2.Stats()["raft"]["num_peers"] != "1" { t.Fatalf("no peer established")
t.Fatalf("bad: %v", s2.Stats()["raft"]) })
}
testutil.WaitForResult(func() (bool, error) {
return s2.Stats()["raft"]["num_peers"] == "1", nil
}, func(err error) {
t.Fatalf("no peer established")
})
} }