From 864688832674b7947c70cd201318dd2b172305b7 Mon Sep 17 00:00:00 2001 From: Neil Twigg Date: Tue, 23 Jul 2024 19:19:36 +0100 Subject: [PATCH] NRG: De-flake `TestNRGSwitchStateClearsQueues` Signed-off-by: Neil Twigg --- server/raft_test.go | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/server/raft_test.go b/server/raft_test.go index 692d3d518fc..9f97bbc4ea8 100644 --- a/server/raft_test.go +++ b/server/raft_test.go @@ -364,15 +364,12 @@ 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{}) n.switchState(Follower) require_Equal(t, n.prop.len(), 0)