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() {
1403
1403
wg .Wait ()
1404
1404
})
1405
1405
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 )
1407
1408
1408
1409
ctrl .CacheSyncTimeout = time .Second
1409
1410
numWatches := 10
@@ -1417,9 +1418,11 @@ var _ = Describe("controller", func() {
1417
1418
}
1418
1419
1419
1420
By ("calling Warmup and Start concurrently" )
1421
+ blockOnStartChan := make (chan struct {})
1420
1422
go func () {
1421
1423
defer GinkgoRecover ()
1422
1424
Expect (ctrl .Start (ctx )).To (Succeed ())
1425
+ close (blockOnStartChan )
1423
1426
}()
1424
1427
1425
1428
blockOnWarmupChan := make (chan struct {})
@@ -1431,6 +1434,10 @@ var _ = Describe("controller", func() {
1431
1434
1432
1435
<- blockOnWarmupChan
1433
1436
1437
+ cancel ()
1438
+
1439
+ <- blockOnStartChan
1440
+
1434
1441
Expect (watchStartedCount .Load ()).To (Equal (int32 (numWatches )), "source should only be started once" )
1435
1442
Expect (ctrl .startWatches ).To (BeNil (), "startWatches should be reset to nil after they are started" )
1436
1443
})
You can’t perform that action at this time.
0 commit comments