File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -1403,7 +1403,8 @@ var _ = Describe("controller", func() {
14031403 wg .Wait ()
14041404 })
14051405
1406- It ("should not cause a data race when called concurrently with Start and only start sources once" , func (ctx SpecContext ) {
1406+ It ("should not cause a data race when called concurrently with Start and only start sources once" , func (specCtx SpecContext ) {
1407+ ctx , cancel := context .WithCancel (specCtx )
14071408
14081409 ctrl .CacheSyncTimeout = time .Second
14091410 numWatches := 10
@@ -1417,9 +1418,11 @@ var _ = Describe("controller", func() {
14171418 }
14181419
14191420 By ("calling Warmup and Start concurrently" )
1421+ blockOnStartChan := make (chan struct {})
14201422 go func () {
14211423 defer GinkgoRecover ()
14221424 Expect (ctrl .Start (ctx )).To (Succeed ())
1425+ close (blockOnStartChan )
14231426 }()
14241427
14251428 blockOnWarmupChan := make (chan struct {})
@@ -1431,6 +1434,10 @@ var _ = Describe("controller", func() {
14311434
14321435 <- blockOnWarmupChan
14331436
1437+ cancel ()
1438+
1439+ <- blockOnStartChan
1440+
14341441 Expect (watchStartedCount .Load ()).To (Equal (int32 (numWatches )), "source should only be started once" )
14351442 Expect (ctrl .startWatches ).To (BeNil (), "startWatches should be reset to nil after they are started" )
14361443 })
You can’t perform that action at this time.
0 commit comments