Skip to content

Commit

Permalink
Merge pull request #188 from MrDXY/fix-flaky-result-in-waitLeader
Browse files Browse the repository at this point in the history
Test: Fix flaky leader index in `waitLeader` function
  • Loading branch information
ahrtr authored Mar 23, 2024
2 parents a83a3bb + 387d8b0 commit ebcf5af
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions rafttest/node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func TestPause(t *testing.T) {

func waitLeader(ns []*node) int {
var l map[uint64]struct{}
var lindex int
var lindex = -1

for {
l = make(map[uint64]struct{})
Expand All @@ -144,7 +144,7 @@ func waitLeader(ns []*node) int {
}
}

if len(l) == 1 {
if len(l) == 1 && lindex != -1 {
return lindex
}
}
Expand Down

0 comments on commit ebcf5af

Please sign in to comment.