diff --git a/controllers/apps/component/component_controller_test.go b/controllers/apps/component/component_controller_test.go index b785caf3fcd..a487fadd4b5 100644 --- a/controllers/apps/component/component_controller_test.go +++ b/controllers/apps/component/component_controller_test.go @@ -98,7 +98,7 @@ var _ = Describe("Component Controller", func() { By("clean resources") // delete components (and all dependent sub-resources), and component definitions & versions - testapps.ClearComponentResourcesWithRemoveFinalizerOption(&testCtx) + testapps.ClearComponentResources(&testCtx) // delete rest mocked objects inNS := client.InNamespace(testCtx.DefaultNamespace) diff --git a/pkg/testutil/apps/common_util.go b/pkg/testutil/apps/common_util.go index 230f8ae0a37..cc8c43d0344 100644 --- a/pkg/testutil/apps/common_util.go +++ b/pkg/testutil/apps/common_util.go @@ -373,6 +373,14 @@ func ClearClusterResourcesWithRemoveFinalizerOption(testCtx *testutil.TestContex ClearResourcesWithRemoveFinalizerOption(testCtx, intctrlutil.ComponentVersionSignature, true, hasLabels) } +func ClearComponentResources(testCtx *testutil.TestContext) { + inNs := client.InNamespace(testCtx.DefaultNamespace) + hasLabels := client.HasLabels{testCtx.TestObjLabelKey} + ClearResources(testCtx, intctrlutil.ComponentSignature, inNs, hasLabels) + ClearResources(testCtx, intctrlutil.ComponentDefinitionSignature, hasLabels) + ClearResources(testCtx, intctrlutil.ComponentVersionSignature, hasLabels) +} + // ClearComponentResourcesWithRemoveFinalizerOption clears all dependent resources belonging to existing components. func ClearComponentResourcesWithRemoveFinalizerOption(testCtx *testutil.TestContext) { inNs := client.InNamespace(testCtx.DefaultNamespace)