From aa20d1cea93e3e0a82aab1e586c28f935ffdd297 Mon Sep 17 00:00:00 2001 From: "Akihiko (Aki) Kuroda" <16141898+akihikokuroda@users.noreply.github.com> Date: Fri, 4 Feb 2022 13:39:08 -0500 Subject: [PATCH] change Lister to DynamicClient for subscription clean up (#2616) Signed-off-by: akihikokuroda --- test/e2e/util.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/e2e/util.go b/test/e2e/util.go index 14c27095d4..3d0c8421e6 100644 --- a/test/e2e/util.go +++ b/test/e2e/util.go @@ -391,6 +391,7 @@ func TearDown(namespace string) { var ( clientCtx = context.Background() client = ctx.Ctx().Client() + dynamic = ctx.Ctx().DynamicClient() inNamespace = k8scontrollerclient.InNamespace(namespace) logf = ctx.Ctx().Logf ) @@ -403,14 +404,13 @@ func TearDown(namespace string) { return client.DeleteAllOf(clientCtx, &operatorsv1alpha1.Subscription{}, inNamespace) }).Should(Succeed(), "failed to delete test subscriptions") - Eventually(func() (remaining []operatorsv1alpha1.Subscription, err error) { - list := &operatorsv1alpha1.SubscriptionList{} - err = client.List(clientCtx, list, inNamespace) - if list != nil { - remaining = list.Items + var subscriptiongvr = schema.GroupVersionResource{Group: "operators.coreos.com", Version: "v1alpha1", Resource: "subscriptions"} + Eventually(func() ([]unstructured.Unstructured, error) { + list, err := dynamic.Resource(subscriptiongvr).Namespace(namespace).List(context.Background(), metav1.ListOptions{}) + if err != nil { + return nil, err } - - return + return list.Items, nil }).Should(BeEmpty(), "failed to await deletion of test subscriptions") logf("deleting test installplans...")