@@ -79,7 +79,7 @@ func runTests(admissionReviewVersion string) {
7979 close (stop )
8080 })
8181
82- It ("should scaffold a custom defaulting webhook" , func () {
82+ It ("should scaffold a custom defaulting webhook" , func (specCtx SpecContext ) {
8383 By ("creating a controller manager" )
8484 m , err := manager .New (cfg , manager.Options {})
8585 ExpectWithOffset (1 , err ).NotTo (HaveOccurred ())
@@ -124,7 +124,7 @@ func runTests(admissionReviewVersion string) {
124124 }
125125}` )
126126
127- ctx , cancel := context .WithCancel (context . Background () )
127+ ctx , cancel := context .WithCancel (specCtx )
128128 cancel ()
129129 err = svr .Start (ctx )
130130 if err != nil && ! os .IsNotExist (err ) {
@@ -155,7 +155,7 @@ func runTests(admissionReviewVersion string) {
155155 ExpectWithOffset (1 , w .Code ).To (Equal (http .StatusNotFound ))
156156 })
157157
158- It ("should scaffold a custom defaulting webhook with a custom path" , func () {
158+ It ("should scaffold a custom defaulting webhook with a custom path" , func (specCtx SpecContext ) {
159159 By ("creating a controller manager" )
160160 m , err := manager .New (cfg , manager.Options {})
161161 ExpectWithOffset (1 , err ).NotTo (HaveOccurred ())
@@ -202,7 +202,7 @@ func runTests(admissionReviewVersion string) {
202202 }
203203}` )
204204
205- ctx , cancel := context .WithCancel (context . Background () )
205+ ctx , cancel := context .WithCancel (specCtx )
206206 cancel ()
207207 err = svr .Start (ctx )
208208 if err != nil && ! os .IsNotExist (err ) {
@@ -234,7 +234,7 @@ func runTests(admissionReviewVersion string) {
234234 ExpectWithOffset (1 , w .Code ).To (Equal (http .StatusNotFound ))
235235 })
236236
237- It ("should scaffold a custom defaulting webhook which recovers from panics" , func () {
237+ It ("should scaffold a custom defaulting webhook which recovers from panics" , func (specCtx SpecContext ) {
238238 By ("creating a controller manager" )
239239 m , err := manager .New (cfg , manager.Options {})
240240 ExpectWithOffset (1 , err ).NotTo (HaveOccurred ())
@@ -278,7 +278,7 @@ func runTests(admissionReviewVersion string) {
278278 }
279279}` )
280280
281- ctx , cancel := context .WithCancel (context . Background () )
281+ ctx , cancel := context .WithCancel (specCtx )
282282 cancel ()
283283 err = svr .Start (ctx )
284284 if err != nil && ! os .IsNotExist (err ) {
@@ -298,7 +298,7 @@ func runTests(admissionReviewVersion string) {
298298 ExpectWithOffset (1 , w .Body ).To (ContainSubstring (`"message":"panic: fake panic test [recovered]` ))
299299 })
300300
301- It ("should scaffold a custom validating webhook" , func () {
301+ It ("should scaffold a custom validating webhook" , func (specCtx SpecContext ) {
302302 By ("creating a controller manager" )
303303 m , err := manager .New (cfg , manager.Options {})
304304 ExpectWithOffset (1 , err ).NotTo (HaveOccurred ())
@@ -345,7 +345,7 @@ func runTests(admissionReviewVersion string) {
345345 }
346346}` )
347347
348- ctx , cancel := context .WithCancel (context . Background () )
348+ ctx , cancel := context .WithCancel (specCtx )
349349 cancel ()
350350 err = svr .Start (ctx )
351351 if err != nil && ! os .IsNotExist (err ) {
@@ -375,7 +375,7 @@ func runTests(admissionReviewVersion string) {
375375 EventuallyWithOffset (1 , logBuffer ).Should (gbytes .Say (`"msg":"Validating object","object":{"name":"foo","namespace":"default"},"namespace":"default","name":"foo","resource":{"group":"foo.test.org","version":"v1","resource":"testvalidator"},"user":"","requestID":"07e52e8d-4513-11e9-a716-42010a800270"` ))
376376 })
377377
378- It ("should scaffold a custom validating webhook with a custom path" , func () {
378+ It ("should scaffold a custom validating webhook with a custom path" , func (specCtx SpecContext ) {
379379 By ("creating a controller manager" )
380380 m , err := manager .New (cfg , manager.Options {})
381381 ExpectWithOffset (1 , err ).NotTo (HaveOccurred ())
@@ -424,7 +424,7 @@ func runTests(admissionReviewVersion string) {
424424 }
425425}` )
426426
427- ctx , cancel := context .WithCancel (context . Background () )
427+ ctx , cancel := context .WithCancel (specCtx )
428428 cancel ()
429429 err = svr .Start (ctx )
430430 if err != nil && ! os .IsNotExist (err ) {
@@ -455,7 +455,7 @@ func runTests(admissionReviewVersion string) {
455455 ExpectWithOffset (1 , w .Code ).To (Equal (http .StatusNotFound ))
456456 })
457457
458- It ("should scaffold a custom validating webhook which recovers from panics" , func () {
458+ It ("should scaffold a custom validating webhook which recovers from panics" , func (specCtx SpecContext ) {
459459 By ("creating a controller manager" )
460460 m , err := manager .New (cfg , manager.Options {})
461461 ExpectWithOffset (1 , err ).NotTo (HaveOccurred ())
@@ -497,7 +497,7 @@ func runTests(admissionReviewVersion string) {
497497 }
498498}` )
499499
500- ctx , cancel := context .WithCancel (context . Background () )
500+ ctx , cancel := context .WithCancel (specCtx )
501501 cancel ()
502502 err = svr .Start (ctx )
503503 if err != nil && ! os .IsNotExist (err ) {
@@ -519,9 +519,9 @@ func runTests(admissionReviewVersion string) {
519519 ExpectWithOffset (1 , w .Body ).To (ContainSubstring (`"message":"panic: fake panic test [recovered]` ))
520520 })
521521
522- It ("should scaffold a custom validating webhook to validate deletes" , func () {
522+ It ("should scaffold a custom validating webhook to validate deletes" , func (specCtx SpecContext ) {
523523 By ("creating a controller manager" )
524- ctx , cancel := context .WithCancel (context . Background () )
524+ ctx , cancel := context .WithCancel (specCtx )
525525
526526 m , err := manager .New (cfg , manager.Options {})
527527 ExpectWithOffset (1 , err ).NotTo (HaveOccurred ())
@@ -630,7 +630,7 @@ func runTests(admissionReviewVersion string) {
630630 Expect (err ).To (HaveOccurred ())
631631 })
632632
633- It ("should scaffold a custom defaulting and validating webhook" , func () {
633+ It ("should scaffold a custom defaulting and validating webhook" , func (specCtx SpecContext ) {
634634 By ("creating a controller manager" )
635635 m , err := manager .New (cfg , manager.Options {})
636636 ExpectWithOffset (1 , err ).NotTo (HaveOccurred ())
@@ -678,7 +678,7 @@ func runTests(admissionReviewVersion string) {
678678 }
679679}` )
680680
681- ctx , cancel := context .WithCancel (context . Background () )
681+ ctx , cancel := context .WithCancel (specCtx )
682682 cancel ()
683683 err = svr .Start (ctx )
684684 if err != nil && ! os .IsNotExist (err ) {
@@ -713,7 +713,7 @@ func runTests(admissionReviewVersion string) {
713713 EventuallyWithOffset (1 , logBuffer ).Should (gbytes .Say (`"msg":"Validating object","object":{"name":"foo","namespace":"default"},"namespace":"default","name":"foo","resource":{"group":"foo.test.org","version":"v1","resource":"testdefaultvalidator"},"user":"","requestID":"07e52e8d-4513-11e9-a716-42010a800270"` ))
714714 })
715715
716- It ("should scaffold a custom defaulting and validating webhook with a custom path for each of them" , func () {
716+ It ("should scaffold a custom defaulting and validating webhook with a custom path for each of them" , func (specCtx SpecContext ) {
717717 By ("creating a controller manager" )
718718 m , err := manager .New (cfg , manager.Options {})
719719 ExpectWithOffset (1 , err ).NotTo (HaveOccurred ())
@@ -765,7 +765,7 @@ func runTests(admissionReviewVersion string) {
765765 }
766766}` )
767767
768- ctx , cancel := context .WithCancel (context . Background () )
768+ ctx , cancel := context .WithCancel (specCtx )
769769 cancel ()
770770 err = svr .Start (ctx )
771771 if err != nil && ! os .IsNotExist (err ) {
0 commit comments