From ac6e65db5a85da3288e593ea9e43ad487176a4a8 Mon Sep 17 00:00:00 2001 From: fabriziopandini Date: Tue, 21 Nov 2023 18:35:14 +0100 Subject: [PATCH] fix provider namespace secret not included in clusterctl move --- cmd/clusterctl/client/cluster/objectgraph.go | 2 +- cmd/clusterctl/client/cluster/objectgraph_test.go | 10 +--------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/cmd/clusterctl/client/cluster/objectgraph.go b/cmd/clusterctl/client/cluster/objectgraph.go index b0934b45c7dc..954cdeecfb46 100644 --- a/cmd/clusterctl/client/cluster/objectgraph.go +++ b/cmd/clusterctl/client/cluster/objectgraph.go @@ -432,7 +432,7 @@ func (o *objectGraph) Discovery(namespace string) error { } // if we are discovering Secrets, also secrets from the providers namespace should be included. - if discoveryType.typeMeta.GetObjectKind().GroupVersionKind().GroupKind() == corev1.SchemeGroupVersion.WithKind("SecretList").GroupKind() { + if discoveryType.typeMeta.GetObjectKind().GroupVersionKind().GroupKind() == corev1.SchemeGroupVersion.WithKind("Secret").GroupKind() { providers, err := o.providerInventory.List() if err != nil { return err diff --git a/cmd/clusterctl/client/cluster/objectgraph_test.go b/cmd/clusterctl/client/cluster/objectgraph_test.go index dcd856f48521..9a224844f74f 100644 --- a/cmd/clusterctl/client/cluster/objectgraph_test.go +++ b/cmd/clusterctl/client/cluster/objectgraph_test.go @@ -1695,15 +1695,7 @@ func getFakeProxyWithCRDs() *test.FakeProxy { } func getFakeDiscoveryTypes(graph *objectGraph) error { - if err := graph.getDiscoveryTypes(); err != nil { - return err - } - - // Given that the Fake client behaves in a different way than real client, for this test we are required to add the List suffix to all the types. - for _, discoveryType := range graph.types { - discoveryType.typeMeta.Kind = fmt.Sprintf("%sList", discoveryType.typeMeta.Kind) - } - return nil + return graph.getDiscoveryTypes() } func TestObjectGraph_Discovery(t *testing.T) {