@@ -834,7 +834,12 @@ func TestRotateFromLeaderToFollower(t *testing.T) {
834
834
assert .NoError (t , err )
835
835
defer wal .Close ()
836
836
837
+ var restartTimersWG sync.WaitGroup
838
+ restartTimersWG .Add (2 )
837
839
reqPool := & mocks.RequestPool {}
840
+ reqPool .On ("RestartTimers" ).Run (func (args mock.Arguments ) {
841
+ restartTimersWG .Done ()
842
+ })
838
843
reqPool .On ("Prune" , mock .Anything )
839
844
reqPool .On ("Close" )
840
845
leaderMon := & mocks.LeaderMonitor {}
@@ -969,6 +974,7 @@ func TestRotateFromLeaderToFollower(t *testing.T) {
969
974
controller .ProcessMessages (1 , commit1Next )
970
975
controller .ProcessMessages (3 , commit3Next )
971
976
leaderMonWG .Wait ()
977
+ restartTimersWG .Wait ()
972
978
appWG .Wait ()
973
979
app .AssertNumberOfCalls (t , "Deliver" , 2 )
974
980
@@ -987,9 +993,14 @@ func TestRotateFromFollowerToLeader(t *testing.T) {
987
993
assert .NoError (t , err )
988
994
defer wal .Close ()
989
995
996
+ var restartTimersWG sync.WaitGroup
997
+ restartTimersWG .Add (2 )
990
998
reqPool := & mocks.RequestPool {}
991
999
reqPool .On ("Prune" , mock .Anything )
992
1000
reqPool .On ("Close" )
1001
+ reqPool .On ("RestartTimers" ).Run (func (args mock.Arguments ) {
1002
+ restartTimersWG .Done ()
1003
+ })
993
1004
leaderMon := & mocks.LeaderMonitor {}
994
1005
leaderMonWG := sync.WaitGroup {}
995
1006
leaderMon .On ("ChangeRole" , bft .Leader , mock .Anything , mock .Anything ).Run (func (args mock.Arguments ) {
@@ -1132,6 +1143,7 @@ func TestRotateFromFollowerToLeader(t *testing.T) {
1132
1143
controller .ProcessMessages (1 , commit1Next )
1133
1144
controller .ProcessMessages (2 , commit2Next )
1134
1145
followerMonWG .Wait ()
1146
+ restartTimersWG .Wait ()
1135
1147
appWG .Wait ()
1136
1148
app .AssertNumberOfCalls (t , "Deliver" , 2 )
1137
1149
0 commit comments