Remove race condition in templated controller test
@@ -96,10 +96,10 @@ func SetupTestReconcile(inner reconcile.Reconciler) (reconcile.Reconciler, chan
func StartTestManager(mgr manager.Manager, g *gomega.GomegaWithT) (chan struct{}, *sync.WaitGroup) {
stop := make(chan struct{})
wg := &sync.WaitGroup{}
- go func() {
wg.Add(1)
+ go func() {
+ defer wg.Done()
g.Expect(mgr.Start(stop)).NotTo(gomega.HaveOccurred())
- wg.Done()
}()
return stop, wg
}
