Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

De-flake TestNRGSwitchStateClearsQueues #5707

Merged
merged 1 commit into from
Jul 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions server/raft_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,12 +364,26 @@ func TestNRGSwitchStateClearsQueues(t *testing.T) {
rg := c.createMemRaftGroup("TEST", 3, newStateAdder)
rg.waitOnLeader()

// Ensure there are no other nodes running that could
// send something into our IP queues or it may break the
// below assertions.
for _, n := range rg {
if !n.node().Leader() {
n.stop()
}
}

rg.lockAll()
defer rg.unlockAll()

n := rg.leader().node().(*raft)
require_Equal(t, n.prop.len(), 0)
require_Equal(t, n.resp.len(), 0)

n.prop.push(&Entry{})
n.resp.push(&appendEntryResponse{})
require_Equal(t, n.prop.len(), 1)
require_Equal(t, n.resp.len(), 1)

n.switchState(Follower)
require_Equal(t, n.prop.len(), 0)
Expand Down