Skip to content

Commit

Permalink
NRG: De-flake TestNRGSwitchStateClearsQueues
Browse files Browse the repository at this point in the history
Signed-off-by: Neil Twigg <neil@nats.io>
  • Loading branch information
neilalexander committed Jul 23, 2024
1 parent 5857a63 commit 7318d77
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions server/raft_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,15 +364,14 @@ func TestNRGSwitchStateClearsQueues(t *testing.T) {
rg := c.createMemRaftGroup("TEST", 3, newStateAdder)
rg.waitOnLeader()

sa := rg.leader().(*stateAdder)
n := sa.node().(*raft)

for i := 0; i < 10_000; i++ {
sa.proposeDelta(1)
}
rg.lockAll()
defer rg.unlockAll()

n.Lock()
defer n.Unlock()
n := rg.leader().node().(*raft)
n.prop.push(&Entry{})
n.resp.push(&appendEntryResponse{})
require_NotEqual(t, n.prop.len(), 0)
require_NotEqual(t, n.resp.len(), 0)

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

0 comments on commit 7318d77

Please sign in to comment.