From 3af4c74f37f9812fc82addca0f02be99cc9551b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wojciech=20Tyczy=C5=84ski?= Date: Sat, 28 May 2022 21:36:24 +0200 Subject: [PATCH] Clean shutdown of cronjob integration tests --- test/integration/cronjob/cronjob_test.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/integration/cronjob/cronjob_test.go b/test/integration/cronjob/cronjob_test.go index fc7de4849d2..855ea9c84ad 100644 --- a/test/integration/cronjob/cronjob_test.go +++ b/test/integration/cronjob/cronjob_test.go @@ -155,12 +155,12 @@ func TestCronJobLaunchesPodAndCleansUp(t *testing.T) { cjClient := clientSet.BatchV1().CronJobs(ns.Name) - stopCh := make(chan struct{}) - defer close(stopCh) + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() - informerSet.Start(stopCh) - go cjc.Run(context.TODO(), 1) - go jc.Run(context.TODO(), 1) + informerSet.Start(ctx.Done()) + go cjc.Run(ctx, 1) + go jc.Run(ctx, 1) _, err := cjClient.Create(context.TODO(), newCronJob(cronJobName, ns.Name, "* * * * ?"), metav1.CreateOptions{}) if err != nil {