Skip to content

Commit

Permalink
Wait wrap tests in TestServer_JoinLAN
Browse files Browse the repository at this point in the history
  • Loading branch information
tiwilliam committed May 9, 2014
1 parent 0e865da commit 335cd5a
Showing 1 changed file with 24 additions and 12 deletions.
36 changes: 24 additions & 12 deletions consul/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,17 @@ func TestServer_JoinLAN(t *testing.T) {
}

// Check the members
if len(s1.LANMembers()) != 2 {
testutil.WaitForResult(func() (bool, error) {
return len(s1.LANMembers()) == 2, nil
}, func(err error) {
t.Fatalf("bad len")
}
})

if len(s2.LANMembers()) != 2 {
testutil.WaitForResult(func() (bool, error) {
return len(s2.LANMembers()) == 2, nil
}, func(err error) {
t.Fatalf("bad len")
}
})
}

func TestServer_JoinWAN(t *testing.T) {
Expand All @@ -162,13 +166,17 @@ func TestServer_JoinWAN(t *testing.T) {
}

// Check the members
if len(s1.WANMembers()) != 2 {
testutil.WaitForResult(func() (bool, error) {
return len(s1.WANMembers()) == 2, nil
}, func(err error) {
t.Fatalf("bad len")
}
})

if len(s2.WANMembers()) != 2 {
testutil.WaitForResult(func() (bool, error) {
return len(s2.WANMembers()) == 2, nil
}, func(err error) {
t.Fatalf("bad len")
}
})

// Check the remoteConsuls has both
if len(s1.remoteConsuls) != 2 {
Expand Down Expand Up @@ -271,13 +279,17 @@ func TestServer_JoinLAN_TLS(t *testing.T) {
}

// Check the members
if len(s1.LANMembers()) != 2 {
testutil.WaitForResult(func() (bool, error) {
return len(s1.LANMembers()) == 2, nil
}, func(err error) {
t.Fatalf("bad len")
}
})

if len(s2.LANMembers()) != 2 {
testutil.WaitForResult(func() (bool, error) {
return len(s2.LANMembers()) == 2, nil
}, func(err error) {
t.Fatalf("bad len")
}
})

// Verify Raft has established a peer
testutil.WaitForResult(func() (bool, error) {
Expand Down

0 comments on commit 335cd5a

Please sign in to comment.