Skip to content

Commit

Permalink
test: de-flake test case TestMemberList
Browse files Browse the repository at this point in the history
get memberlist immediately before each time checking the members.

Signed-off-by: Benjamin Wang <[email protected]>
  • Loading branch information
ahrtr committed Sep 6, 2023
1 parent 14ecc7a commit 1b87ec4
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions tests/common/member_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,18 @@ func TestMemberList(t *testing.T) {
if expectNum != gotNum {
t.Fatalf("number of members not equal, expect: %d, got: %d", expectNum, gotNum)
}
assert.Eventually(t, func() (done bool) {
assert.Eventually(t, func() bool {
resp, err := cc.MemberList(ctx, false)
if err != nil {
t.Logf("Failed to get member list, err: %v", err)
return false
}
for _, m := range resp.Members {
if len(m.ClientURLs) == 0 {
t.Logf("member is not started, memberId:%d, memberName:%s", m.ID, m.Name)
done = false
return done
return false
}
}
done = true
return true
}, time.Second*5, time.Millisecond*100)
})
Expand Down

0 comments on commit 1b87ec4

Please sign in to comment.