From 775321fde9337915c2425eb8f6b613f0d6066b61 Mon Sep 17 00:00:00 2001 From: dprotaso Date: Tue, 8 Jun 2021 10:49:50 -0400 Subject: [PATCH] wire in the correct dynamic client --- pkg/reconciler/source/duck/controller_test.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/pkg/reconciler/source/duck/controller_test.go b/pkg/reconciler/source/duck/controller_test.go index 1cc758d532f..af772f0b7fd 100644 --- a/pkg/reconciler/source/duck/controller_test.go +++ b/pkg/reconciler/source/duck/controller_test.go @@ -17,7 +17,6 @@ limitations under the License. package duck import ( - "context" "testing" "k8s.io/apimachinery/pkg/runtime/schema" @@ -26,6 +25,7 @@ import ( // Fake injection informers _ "knative.dev/eventing/pkg/client/injection/informers/eventing/v1beta1/eventtype/fake" _ "knative.dev/pkg/client/injection/apiextensions/informers/apiextensions/v1/customresourcedefinition/fake" + sourceinformer "knative.dev/pkg/client/injection/ducks/duck/v1/source" _ "knative.dev/pkg/client/injection/ducks/duck/v1/source/fake" fakedynamicclient "knative.dev/pkg/injection/clients/dynamicclient/fake" @@ -34,10 +34,13 @@ import ( ) func TestNew(t *testing.T) { - ctx, _ := SetupFakeContext(t, func(ctx context.Context) context.Context { - ctx, _ = fakedynamicclient.With(ctx, NewScheme()) - return ctx - }) + ctx, _ := SetupFakeContext(t) + + // Re-wire some injection so that an informer has a dynamic client + // with the correct scheme + ctx, _ = fakedynamicclient.With(ctx, NewScheme()) + ctx, _ = fakedynamicclient.With(ctx, NewScheme()) + ctx = sourceinformer.WithDuck(ctx) gvr := schema.GroupVersionResource{ Group: "testing.sources.knative.dev",