Skip to content

Commit aa20d1c

Browse files
change Lister to DynamicClient for subscription clean up (#2616)
Signed-off-by: akihikokuroda <[email protected]>
1 parent 7a7416e commit aa20d1c

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

test/e2e/util.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,7 @@ func TearDown(namespace string) {
391391
var (
392392
clientCtx = context.Background()
393393
client = ctx.Ctx().Client()
394+
dynamic = ctx.Ctx().DynamicClient()
394395
inNamespace = k8scontrollerclient.InNamespace(namespace)
395396
logf = ctx.Ctx().Logf
396397
)
@@ -403,14 +404,13 @@ func TearDown(namespace string) {
403404
return client.DeleteAllOf(clientCtx, &operatorsv1alpha1.Subscription{}, inNamespace)
404405
}).Should(Succeed(), "failed to delete test subscriptions")
405406

406-
Eventually(func() (remaining []operatorsv1alpha1.Subscription, err error) {
407-
list := &operatorsv1alpha1.SubscriptionList{}
408-
err = client.List(clientCtx, list, inNamespace)
409-
if list != nil {
410-
remaining = list.Items
407+
var subscriptiongvr = schema.GroupVersionResource{Group: "operators.coreos.com", Version: "v1alpha1", Resource: "subscriptions"}
408+
Eventually(func() ([]unstructured.Unstructured, error) {
409+
list, err := dynamic.Resource(subscriptiongvr).Namespace(namespace).List(context.Background(), metav1.ListOptions{})
410+
if err != nil {
411+
return nil, err
411412
}
412-
413-
return
413+
return list.Items, nil
414414
}).Should(BeEmpty(), "failed to await deletion of test subscriptions")
415415

416416
logf("deleting test installplans...")

0 commit comments

Comments
 (0)