@@ -49,15 +49,16 @@ func (typedNoop) Reconcile(context.Context, reconcile.Request) (reconcile.Result
4949}
5050
5151var _ = Describe ("application" , func () {
52- var stop chan struct {}
52+ var ctx context.Context
53+ var cancel context.CancelFunc
5354
5455 BeforeEach (func () {
55- stop = make ( chan struct {} )
56+ ctx , cancel = context . WithCancel ( context . Background () )
5657 newController = controller .New
5758 })
5859
5960 AfterEach (func () {
60- close ( stop )
61+ cancel ( )
6162 })
6263
6364 noop := reconcile .Func (func (context.Context , reconcile.Request ) (reconcile.Result , error ) {
@@ -218,7 +219,7 @@ var _ = Describe("application", func() {
218219 bldr := ControllerManagedBy (m ).
219220 For (& appsv1.Deployment {}).
220221 Owns (& appsv1.ReplicaSet {})
221- doReconcileTest ("3" , stop , bldr , m , false )
222+ doReconcileTest (ctx , "3" , bldr , m , false )
222223 close (done )
223224 }, 10 )
224225
@@ -231,7 +232,7 @@ var _ = Describe("application", func() {
231232 Watches ( // Equivalent of Owns
232233 & source.Kind {Type : & appsv1.ReplicaSet {}},
233234 & handler.EnqueueRequestForOwner {OwnerType : & appsv1.Deployment {}, IsController : true })
234- doReconcileTest ("4" , stop , bldr , m , true )
235+ doReconcileTest (ctx , "4" , bldr , m , true )
235236 close (done )
236237 }, 10 )
237238 })
@@ -286,7 +287,7 @@ var _ = Describe("application", func() {
286287 Owns (& appsv1.ReplicaSet {}, WithPredicates (replicaSetPrct )).
287288 WithEventFilter (allPrct )
288289
289- doReconcileTest ("5" , stop , bldr , m , true )
290+ doReconcileTest (ctx , "5" , bldr , m , true )
290291
291292 Expect (deployPrctExecuted ).To (BeTrue (), "Deploy predicated should be called at least once" )
292293 Expect (replicaSetPrctExecuted ).To (BeTrue (), "ReplicaSet predicated should be called at least once" )
@@ -298,7 +299,7 @@ var _ = Describe("application", func() {
298299
299300})
300301
301- func doReconcileTest (nameSuffix string , stop chan struct {} , blder * Builder , mgr manager.Manager , complete bool ) {
302+ func doReconcileTest (ctx context. Context , nameSuffix string , blder * Builder , mgr manager.Manager , complete bool ) {
302303 deployName := "deploy-name-" + nameSuffix
303304 rsName := "rs-name-" + nameSuffix
304305
@@ -328,7 +329,7 @@ func doReconcileTest(nameSuffix string, stop chan struct{}, blder *Builder, mgr
328329 By ("Starting the application" )
329330 go func () {
330331 defer GinkgoRecover ()
331- Expect (mgr .Start (stop )).NotTo (HaveOccurred ())
332+ Expect (mgr .Start (ctx )).NotTo (HaveOccurred ())
332333 By ("Stopping the application" )
333334 }()
334335
0 commit comments