Skip to content

Commit 0df2b10

Browse files
committed
Remove race condition in templated controller test
1 parent cb3a7e0 commit 0df2b10

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pkg/scaffold/controller/controllersuitetest.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,10 @@ func SetupTestReconcile(inner reconcile.Reconciler) (reconcile.Reconciler, chan
9696
func StartTestManager(mgr manager.Manager, g *gomega.GomegaWithT) (chan struct{}, *sync.WaitGroup) {
9797
stop := make(chan struct{})
9898
wg := &sync.WaitGroup{}
99+
wg.Add(1)
99100
go func() {
100-
wg.Add(1)
101+
defer wg.Done()
101102
g.Expect(mgr.Start(stop)).NotTo(gomega.HaveOccurred())
102-
wg.Done()
103103
}()
104104
return stop, wg
105105
}

0 commit comments

Comments
 (0)