File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -462,6 +462,7 @@ var _ = Describe("controller", func() {
462
462
// Start the sources in a goroutine
463
463
startErrCh := make (chan error )
464
464
go func () {
465
+ defer GinkgoRecover ()
465
466
startErrCh <- ctrl .startEventSources (sourceCtx )
466
467
}()
467
468
@@ -1079,17 +1080,26 @@ var _ = Describe("controller", func() {
1079
1080
1080
1081
resultChan := make (chan bool )
1081
1082
1083
+ // Wait for the goroutines to finish before returning to avoid racing with the
1084
+ // assignment in BeforeEach block.
1085
+ var wg sync.WaitGroup
1086
+
1082
1087
// Invoked in goroutines because the Warmup / WaitForWarmupComplete will block forever.
1088
+ wg .Add (2 )
1083
1089
go func () {
1084
- err := ctrl .Warmup (ctx )
1085
- Expect (err ).NotTo (HaveOccurred ())
1090
+ defer GinkgoRecover ()
1091
+ defer wg .Done ()
1092
+ Expect (ctrl .Warmup (ctx )).To (Succeed ())
1086
1093
}()
1087
1094
go func () {
1095
+ defer GinkgoRecover ()
1096
+ defer wg .Done ()
1088
1097
resultChan <- ctrl .WaitForWarmupComplete (ctx )
1089
1098
}()
1090
1099
1091
1100
cancel ()
1092
1101
Expect (<- resultChan ).To (BeTrue ())
1102
+ wg .Wait ()
1093
1103
})
1094
1104
1095
1105
It ("should be called before leader election runnables if warmup is enabled" , func () {
You can’t perform that action at this time.
0 commit comments