diff --git a/pkg/broker/filter/filter_handler_test.go b/pkg/broker/filter/filter_handler_test.go index 6d07a04e3c1..15236d99d1f 100644 --- a/pkg/broker/filter/filter_handler_test.go +++ b/pkg/broker/filter/filter_handler_test.go @@ -37,7 +37,6 @@ import ( "go.uber.org/zap/zaptest" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" - "k8s.io/client-go/kubernetes/scheme" "knative.dev/pkg/apis" eventingv1 "knative.dev/eventing/pkg/apis/eventing/v1" @@ -64,11 +63,6 @@ var ( validPath = fmt.Sprintf("/triggers/%s/%s/%s", testNS, triggerName, triggerUID) ) -func init() { - // Add types to scheme. - _ = eventingv1.AddToScheme(scheme.Scheme) -} - func TestReceiver(t *testing.T) { testCases := map[string]struct { triggers []*eventingv1.Trigger diff --git a/pkg/duck/listable_test.go b/pkg/duck/listable_test.go index f152d8600fd..80d5b76c446 100644 --- a/pkg/duck/listable_test.go +++ b/pkg/duck/listable_test.go @@ -31,16 +31,10 @@ import ( "k8s.io/client-go/tools/cache" "knative.dev/pkg/apis/duck" duckv1 "knative.dev/pkg/apis/duck/v1" - duckv1alpha1 "knative.dev/pkg/apis/duck/v1alpha1" "knative.dev/pkg/client/injection/ducks/duck/v1alpha1/addressable" fakedynamicclient "knative.dev/pkg/injection/clients/dynamicclient/fake" ) -func init() { - // Add types to scheme - _ = duckv1alpha1.AddToScheme(scheme.Scheme) -} - const ns = "test-ns" var errTest = errors.New("test error") diff --git a/pkg/duck/subscriber_test.go b/pkg/duck/subscriber_test.go index 835e9036ea9..e557890142a 100644 --- a/pkg/duck/subscriber_test.go +++ b/pkg/duck/subscriber_test.go @@ -24,23 +24,12 @@ import ( corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/client-go/dynamic" - - "k8s.io/client-go/kubernetes/scheme" - - eventingv1 "knative.dev/eventing/pkg/apis/eventing/v1" - duckv1 "knative.dev/pkg/apis/duck/v1" ) var ( testNS = "testnamespace" ) -func init() { - // Add types to scheme - _ = eventingv1.AddToScheme(scheme.Scheme) - _ = duckv1.AddToScheme(scheme.Scheme) -} - func TestDomainToURL(t *testing.T) { d := "default-broker.default.svc.cluster.local" e := fmt.Sprintf("http://%s/", d) diff --git a/pkg/reconciler/apiserversource/apiserversource_test.go b/pkg/reconciler/apiserversource/apiserversource_test.go index 7bf11f979f2..381e4dfbd4e 100644 --- a/pkg/reconciler/apiserversource/apiserversource_test.go +++ b/pkg/reconciler/apiserversource/apiserversource_test.go @@ -27,7 +27,6 @@ import ( corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" - "k8s.io/client-go/kubernetes/scheme" clientgotesting "k8s.io/client-go/testing" sourcesv1 "knative.dev/eventing/pkg/apis/sources/v1" @@ -88,13 +87,6 @@ const ( generation = 1 ) -func init() { - // Add types to scheme - _ = appsv1.AddToScheme(scheme.Scheme) - _ = corev1.AddToScheme(scheme.Scheme) - _ = duckv1.AddToScheme(scheme.Scheme) -} - func TestReconcile(t *testing.T) { table := TableTest{{ Name: "not enough permissions", diff --git a/pkg/reconciler/broker/broker_test.go b/pkg/reconciler/broker/broker_test.go index 5cee90d3d9f..20c43c08836 100644 --- a/pkg/reconciler/broker/broker_test.go +++ b/pkg/reconciler/broker/broker_test.go @@ -25,11 +25,9 @@ import ( "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" - "k8s.io/client-go/kubernetes/scheme" clientgotesting "k8s.io/client-go/testing" "knative.dev/eventing/pkg/apis/eventing" - eventingv1 "knative.dev/eventing/pkg/apis/eventing/v1" fakeeventingclient "knative.dev/eventing/pkg/client/injection/client/fake" "knative.dev/eventing/pkg/client/injection/ducks/duck/v1/channelable" "knative.dev/eventing/pkg/client/injection/reconciler/eventing/v1/broker" @@ -84,12 +82,6 @@ var ( } ) -func init() { - // Add types to scheme - _ = eventingv1.AddToScheme(scheme.Scheme) - _ = duckv1.AddToScheme(scheme.Scheme) -} - func TestReconcile(t *testing.T) { table := TableTest{ { diff --git a/pkg/reconciler/broker/trigger/trigger_test.go b/pkg/reconciler/broker/trigger/trigger_test.go index e5a61222eda..27b32aef657 100644 --- a/pkg/reconciler/broker/trigger/trigger_test.go +++ b/pkg/reconciler/broker/trigger/trigger_test.go @@ -27,7 +27,6 @@ import ( "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" - "k8s.io/client-go/kubernetes/scheme" clientgotesting "k8s.io/client-go/testing" eventingduckv1 "knative.dev/eventing/pkg/apis/duck/v1" v1 "knative.dev/eventing/pkg/apis/duck/v1" @@ -140,12 +139,6 @@ var ( } ) -func init() { - // Add types to scheme - _ = eventingv1.AddToScheme(scheme.Scheme) - _ = duckv1.AddToScheme(scheme.Scheme) -} - func TestReconcile(t *testing.T) { table := TableTest{ { diff --git a/pkg/reconciler/channel/channel_test.go b/pkg/reconciler/channel/channel_test.go index 1b56c8aa7ac..60fb6ee2c90 100644 --- a/pkg/reconciler/channel/channel_test.go +++ b/pkg/reconciler/channel/channel_test.go @@ -23,11 +23,9 @@ import ( "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" - "k8s.io/client-go/kubernetes/scheme" clientgotesting "k8s.io/client-go/testing" "k8s.io/utils/pointer" eventingduckv1 "knative.dev/eventing/pkg/apis/duck/v1" - messagingv1 "knative.dev/eventing/pkg/apis/messaging/v1" fakeeventingclient "knative.dev/eventing/pkg/client/injection/client/fake" "knative.dev/eventing/pkg/client/injection/ducks/duck/v1/channelable" channelreconciler "knative.dev/eventing/pkg/client/injection/reconciler/messaging/v1/channel" @@ -58,12 +56,6 @@ var ( } ) -func init() { - // Add types to scheme - _ = messagingv1.AddToScheme(scheme.Scheme) - _ = eventingduckv1.AddToScheme(scheme.Scheme) -} - func TestReconcile(t *testing.T) { table := TableTest{{ @@ -325,7 +317,7 @@ func channelCRD() metav1.TypeMeta { func channelCRDBadGvk() metav1.TypeMeta { return metav1.TypeMeta{ APIVersion: "", - Kind: "", + Kind: "-BrokenKind", } } diff --git a/pkg/reconciler/containersource/containersource_test.go b/pkg/reconciler/containersource/containersource_test.go index 7b3ab96c592..072e3072c5c 100644 --- a/pkg/reconciler/containersource/containersource_test.go +++ b/pkg/reconciler/containersource/containersource_test.go @@ -28,7 +28,6 @@ import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" - "k8s.io/client-go/kubernetes/scheme" clientgotesting "k8s.io/client-go/testing" fakeeventingclient "knative.dev/eventing/pkg/client/injection/client/fake" "knative.dev/pkg/apis" @@ -76,13 +75,6 @@ var ( } ) -func init() { - // Add types to scheme - _ = appsv1.AddToScheme(scheme.Scheme) - _ = corev1.AddToScheme(scheme.Scheme) - _ = duckv1.AddToScheme(scheme.Scheme) -} - func TestAllCases(t *testing.T) { table := TableTest{ { diff --git a/pkg/reconciler/eventtype/eventtype_test.go b/pkg/reconciler/eventtype/eventtype_test.go index cae6b1b7999..99668697b6c 100644 --- a/pkg/reconciler/eventtype/eventtype_test.go +++ b/pkg/reconciler/eventtype/eventtype_test.go @@ -24,9 +24,7 @@ import ( corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" - "k8s.io/client-go/kubernetes/scheme" clientgotesting "k8s.io/client-go/testing" - v1 "knative.dev/eventing/pkg/apis/eventing/v1" fakeeventingclient "knative.dev/eventing/pkg/client/injection/client/fake" "knative.dev/eventing/pkg/client/injection/reconciler/eventing/v1beta1/eventtype" . "knative.dev/eventing/pkg/reconciler/testing/v1" @@ -53,11 +51,6 @@ var ( } ) -func init() { - // Add types to scheme - _ = v1.AddToScheme(scheme.Scheme) -} - func TestReconcile(t *testing.T) { table := TableTest{{ Name: "bad workqueue key", diff --git a/pkg/reconciler/inmemorychannel/controller/inmemorychannel_test.go b/pkg/reconciler/inmemorychannel/controller/inmemorychannel_test.go index b3501bbb9f7..ea65f75cdf6 100644 --- a/pkg/reconciler/inmemorychannel/controller/inmemorychannel_test.go +++ b/pkg/reconciler/inmemorychannel/controller/inmemorychannel_test.go @@ -40,14 +40,12 @@ import ( rbacv1 "k8s.io/api/rbac/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" - "k8s.io/client-go/kubernetes/scheme" clientgotesting "k8s.io/client-go/testing" eventingduckv1 "knative.dev/eventing/pkg/apis/duck/v1" v1 "knative.dev/eventing/pkg/apis/messaging/v1" "knative.dev/eventing/pkg/reconciler/inmemorychannel/controller/resources" . "knative.dev/eventing/pkg/reconciler/testing/v1" "knative.dev/pkg/apis" - duckv1 "knative.dev/pkg/apis/duck/v1" "knative.dev/pkg/configmap" "knative.dev/pkg/controller" "knative.dev/pkg/kmeta" @@ -67,12 +65,6 @@ const ( imcGeneration = 7 ) -func init() { - // Add types to scheme - _ = v1.AddToScheme(scheme.Scheme) - _ = duckv1.AddToScheme(scheme.Scheme) -} - func TestAllCases(t *testing.T) { imcKey := testNS + "/" + imcName subscriber1UID := types.UID("2f9b5e8e-deb6-11e8-9f32-f2801f1b9fd1") diff --git a/pkg/reconciler/inmemorychannel/dispatcher/inmemorychannel_test.go b/pkg/reconciler/inmemorychannel/dispatcher/inmemorychannel_test.go index a161a785e74..8f22449f087 100644 --- a/pkg/reconciler/inmemorychannel/dispatcher/inmemorychannel_test.go +++ b/pkg/reconciler/inmemorychannel/dispatcher/inmemorychannel_test.go @@ -26,7 +26,6 @@ import ( corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" - "k8s.io/client-go/kubernetes/scheme" clientgotesting "k8s.io/client-go/testing" "k8s.io/utils/pointer" "knative.dev/pkg/apis" @@ -101,11 +100,6 @@ var ( subscribers = []eventingduckv1.SubscriberSpec{subscriber1, subscriber2} ) -func init() { - // Add types to scheme - _ = v1.AddToScheme(scheme.Scheme) -} - func TestAllCases(t *testing.T) { backoffPolicy := eventingduckv1.BackoffPolicyLinear diff --git a/pkg/reconciler/parallel/parallel_test.go b/pkg/reconciler/parallel/parallel_test.go index a660b421c78..52ae8606c86 100644 --- a/pkg/reconciler/parallel/parallel_test.go +++ b/pkg/reconciler/parallel/parallel_test.go @@ -31,7 +31,6 @@ import ( "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" - "k8s.io/client-go/kubernetes/scheme" clientgotesting "k8s.io/client-go/testing" eventingduckv1 "knative.dev/eventing/pkg/apis/duck/v1" "knative.dev/eventing/pkg/client/injection/ducks/duck/v1/channelable" @@ -66,12 +65,6 @@ var ( } ) -func init() { - // Add types to scheme - _ = v1.AddToScheme(scheme.Scheme) - _ = duckv1.AddToScheme(scheme.Scheme) -} - func TestAllBranches(t *testing.T) { pKey := testNS + "/" + parallelName imc := &messagingv1.ChannelTemplateSpec{ diff --git a/pkg/reconciler/pingsource/pingsource_test.go b/pkg/reconciler/pingsource/pingsource_test.go index 5db27db83b6..375ca64a9ee 100644 --- a/pkg/reconciler/pingsource/pingsource_test.go +++ b/pkg/reconciler/pingsource/pingsource_test.go @@ -28,7 +28,6 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" - "k8s.io/client-go/kubernetes/scheme" clientgotesting "k8s.io/client-go/testing" "knative.dev/pkg/apis" @@ -92,13 +91,6 @@ const ( generation = 1 ) -func init() { - // Add types to scheme - _ = appsv1.AddToScheme(scheme.Scheme) - _ = corev1.AddToScheme(scheme.Scheme) - _ = duckv1.AddToScheme(scheme.Scheme) -} - func TestAllCases(t *testing.T) { table := TableTest{ { diff --git a/pkg/reconciler/sequence/sequence_test.go b/pkg/reconciler/sequence/sequence_test.go index ba25027dc1d..6d510753141 100644 --- a/pkg/reconciler/sequence/sequence_test.go +++ b/pkg/reconciler/sequence/sequence_test.go @@ -26,7 +26,6 @@ import ( "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" - "k8s.io/client-go/kubernetes/scheme" clientgotesting "k8s.io/client-go/testing" v1 "knative.dev/eventing/pkg/apis/flows/v1" messagingv1 "knative.dev/eventing/pkg/apis/messaging/v1" @@ -64,12 +63,6 @@ var ( } ) -func init() { - // Add types to scheme - _ = v1.AddToScheme(scheme.Scheme) - _ = duckv1.AddToScheme(scheme.Scheme) -} - func createReplyChannel(channelName string) *duckv1.Destination { return &duckv1.Destination{ Ref: &duckv1.KReference{ diff --git a/pkg/reconciler/source/crd/crd_test.go b/pkg/reconciler/source/crd/crd_test.go index 1cf9b9794fa..4ebf9b8d16b 100644 --- a/pkg/reconciler/source/crd/crd_test.go +++ b/pkg/reconciler/source/crd/crd_test.go @@ -40,6 +40,7 @@ import ( . "knative.dev/pkg/reconciler/testing" // Fake injection informers + _ "knative.dev/eventing/pkg/client/injection/informers/eventing/v1beta1/eventtype/fake" fakeclient "knative.dev/pkg/client/injection/apiextensions/client/fake" _ "knative.dev/pkg/client/injection/apiextensions/informers/apiextensions/v1/customresourcedefinition/fake" @@ -67,6 +68,12 @@ var crdGVK = schema.GroupVersionKind{ Kind: crdKind, } +var crdListGVK = schema.GroupVersionKind{ + Group: crdGroup, + Version: crdVersionServed, + Kind: crdKind + "List", +} + func TestAllCases(t *testing.T) { ctx := context.Background() ctx, _ = injection.Fake.SetupInformers(ctx, &rest.Config{}) diff --git a/pkg/reconciler/subscription/subscription_test.go b/pkg/reconciler/subscription/subscription_test.go index e26f740f417..fd09f1a16f5 100644 --- a/pkg/reconciler/subscription/subscription_test.go +++ b/pkg/reconciler/subscription/subscription_test.go @@ -26,16 +26,13 @@ import ( "knative.dev/pkg/injection/clients/dynamicclient" "knative.dev/pkg/network" - eventingv1 "knative.dev/eventing/pkg/apis/eventing/v1" eventingclient "knative.dev/eventing/pkg/client/injection/client" "knative.dev/eventing/pkg/client/injection/ducks/duck/v1/channelable" corev1 "k8s.io/api/core/v1" - apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" - "k8s.io/client-go/kubernetes/scheme" clientgotesting "k8s.io/client-go/testing" "knative.dev/pkg/apis" duckv1 "knative.dev/pkg/apis/duck/v1" @@ -130,14 +127,6 @@ var ( } ) -func init() { - // Add types to scheme - _ = eventingv1.AddToScheme(scheme.Scheme) - _ = duckv1.AddToScheme(scheme.Scheme) - _ = apiextensionsv1.AddToScheme(scheme.Scheme) - _ = messagingv1.AddToScheme(scheme.Scheme) -} - func TestAllCases(t *testing.T) { linear := eventingduck.BackoffPolicyLinear diff --git a/pkg/reconciler/sugar/namespace/namespace_test.go b/pkg/reconciler/sugar/namespace/namespace_test.go index 9a99ffc98d2..01e520d1f49 100644 --- a/pkg/reconciler/sugar/namespace/namespace_test.go +++ b/pkg/reconciler/sugar/namespace/namespace_test.go @@ -25,7 +25,6 @@ import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" - "k8s.io/client-go/kubernetes/scheme" v1 "knative.dev/eventing/pkg/apis/eventing/v1" fakeeventingclient "knative.dev/eventing/pkg/client/injection/client/fake" "knative.dev/eventing/pkg/reconciler/sugar/resources" @@ -43,11 +42,6 @@ const ( testNS = "test-namespace" ) -func init() { - // Add types to scheme - _ = v1.AddToScheme(scheme.Scheme) -} - func TestEnabledByDefault(t *testing.T) { // Events brokerEvent := Eventf(corev1.EventTypeNormal, "BrokerCreated", "Default eventing.knative.dev Broker created.") diff --git a/pkg/reconciler/sugar/trigger/trigger_test.go b/pkg/reconciler/sugar/trigger/trigger_test.go index b73c6cc024a..33e8dfbc1c9 100644 --- a/pkg/reconciler/sugar/trigger/trigger_test.go +++ b/pkg/reconciler/sugar/trigger/trigger_test.go @@ -23,7 +23,6 @@ import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" - "k8s.io/client-go/kubernetes/scheme" v1 "knative.dev/eventing/pkg/apis/eventing/v1" fakeeventingclient "knative.dev/eventing/pkg/client/injection/client/fake" "knative.dev/eventing/pkg/client/injection/reconciler/eventing/v1/trigger" @@ -43,11 +42,6 @@ const ( brokerName = "default" ) -func init() { - // Add types to scheme - _ = v1.AddToScheme(scheme.Scheme) -} - func TestEnabledByDefault(t *testing.T) { // Events brokerEvent := Eventf(corev1.EventTypeNormal, "BrokerCreated", "Default eventing.knative.dev Broker %q created.", "default")