@@ -462,7 +462,10 @@ func TestTwoSequences(t *testing.T) {
462
462
assert .NoError (t , err )
463
463
log := basicLog .Sugar ()
464
464
comm := & mocks.Comm {}
465
- comm .On ("Broadcast" , mock .Anything )
465
+ commWG := sync.WaitGroup {}
466
+ comm .On ("Broadcast" , mock .Anything ).Run (func (args mock.Arguments ) {
467
+ commWG .Done ()
468
+ })
466
469
decider := & mocks.Decider {}
467
470
deciderWG := sync.WaitGroup {}
468
471
decidedProposal := make (chan types.Proposal , 1 )
@@ -496,16 +499,20 @@ func TestTwoSequences(t *testing.T) {
496
499
}
497
500
end := view .Start ()
498
501
502
+ commWG .Add (1 )
499
503
view .HandleMessage (1 , prePrepare )
504
+ commWG .Wait ()
500
505
501
506
prepareNext := proto .Clone (prepare ).(* protos.Message )
502
507
prepareNextGet := prepareNext .GetPrepare ()
503
508
prepareNextGet .Seq = 1
504
509
510
+ commWG .Add (1 )
505
511
view .HandleMessage (1 , prepare )
506
512
view .HandleMessage (1 , prepareNext )
507
513
view .HandleMessage (2 , prepare )
508
514
view .HandleMessage (2 , prepareNext )
515
+ commWG .Wait ()
509
516
510
517
commit1Next := proto .Clone (commit1 ).(* protos.Message )
511
518
commit1NextGet := commit1Next .GetCommit ()
@@ -525,7 +532,9 @@ func TestTwoSequences(t *testing.T) {
525
532
prePrepareNextGet := prePrepareNext .GetPrePrepare ()
526
533
prePrepareNextGet .Seq = 1
527
534
535
+ commWG .Add (2 )
528
536
view .HandleMessage (1 , prePrepareNext )
537
+ commWG .Wait ()
529
538
530
539
deciderWG .Wait ()
531
540
dProp := <- decidedProposal
0 commit comments