Skip to content

Commit

Permalink
test for s1 members should not be removed
Browse files Browse the repository at this point in the history
  • Loading branch information
mbver committed Aug 21, 2024
1 parent 4bcd5a5 commit 033ad70
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions serf/serf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1699,17 +1699,30 @@ func TestSerf_joinLeaveJoin(t *testing.T) {
r.Fatalf("s2 members: %d", s2.NumNodes())
}

// s2 should see the itself as alive
mems := s2.Members()
anyLeaving := false
// s1 should see the all nodes as alive
mems := s1.Members()
anyNotAlive := false
for _, m := range mems {
if m.Status != StatusAlive {
anyNotAlive = true
break
}
}
if anyNotAlive {
r.Fatalf("all nodes should be alive!")
}

// s2 should see the all nodes as alive
mems = s2.Members()
anyNotAlive = false
for _, m := range mems {
if m.Status == StatusLeaving {
anyLeaving = true
if m.Status != StatusAlive {
anyNotAlive = true
break
}
}
if anyLeaving {
t.Fatalf("all nodes should be alive!")
if anyNotAlive {
r.Fatalf("all nodes should be alive!")
}
})
}
Expand Down

0 comments on commit 033ad70

Please sign in to comment.