File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -638,17 +638,22 @@ func TestSchedulerGuaranteeNonNilNodeInSchedulingCycle(t *testing.T) {
638
638
for i := 0 ; i < waitSchedulingPodNumber ; i ++ {
639
639
allWaitSchedulingPods .Insert (fmt .Sprintf ("pod%d" , i ))
640
640
}
641
- var wg sync.WaitGroup
641
+ var (
642
+ wg sync.WaitGroup
643
+ mu sync.Mutex
644
+ )
642
645
wg .Add (waitSchedulingPodNumber )
643
646
stopFn , err := broadcaster .StartEventWatcher (func (obj runtime.Object ) {
644
647
e , ok := obj .(* eventsv1.Event )
645
648
if ! ok || (e .Reason != "Scheduled" && e .Reason != "FailedScheduling" ) {
646
649
return
647
650
}
651
+ mu .Lock ()
648
652
if allWaitSchedulingPods .Has (e .Regarding .Name ) {
649
653
wg .Done ()
650
654
allWaitSchedulingPods .Delete (e .Regarding .Name )
651
655
}
656
+ mu .Unlock ()
652
657
})
653
658
if err != nil {
654
659
t .Fatal (err )
You can’t perform that action at this time.
0 commit comments