From 0b5df562f18ce0e5bb9b92d933b08589f27dbfe4 Mon Sep 17 00:00:00 2001 From: slinkydeveloper Date: Wed, 2 Sep 2020 17:12:26 +0200 Subject: [PATCH] Fix race condition #3960 Signed-off-by: Francesco Guardiani --- .../inmemorychannel/dispatcher/controller_test.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/reconciler/inmemorychannel/dispatcher/controller_test.go b/pkg/reconciler/inmemorychannel/dispatcher/controller_test.go index d3ae50f907e..28124473694 100644 --- a/pkg/reconciler/inmemorychannel/dispatcher/controller_test.go +++ b/pkg/reconciler/inmemorychannel/dispatcher/controller_test.go @@ -30,7 +30,8 @@ import ( ) func TestNew(t *testing.T) { - ctx, _ := SetupFakeContext(t) + ctx, cancel, _ := SetupFakeContextWithCancel(t) + defer cancel() os.Setenv("SCOPE", eventing.ScopeCluster) c := NewController(ctx, &configmap.InformedWatcher{}) @@ -41,7 +42,8 @@ func TestNew(t *testing.T) { } func TestNewInNamespace(t *testing.T) { - ctx, _ := SetupFakeContext(t) + ctx, cancel, _ := SetupFakeContextWithCancel(t) + defer cancel() os.Setenv("SCOPE", eventing.ScopeNamespace) c := NewController(ctx, &configmap.InformedWatcher{})