diff --git a/pkg/helper/helpers.go b/pkg/helper/helpers.go index af7e03a72..e48a5684c 100644 --- a/pkg/helper/helpers.go +++ b/pkg/helper/helpers.go @@ -265,8 +265,8 @@ func DeleteAppliedResources(resources []workapiv1.AppliedManifestResourceMeta, d } pendingFinalization := u.GetDeletionTimestamp() != nil && !u.GetDeletionTimestamp().IsZero() + waitingForFinalization := len(resource.UID) > 0 if pendingFinalization { - waitingForFinalization := len(resource.UID) > 0 if waitingForFinalization && resource.UID != string(u.GetUID()) { // the instance is deleted, so do not add to the resourcesPendingDeletion list continue @@ -280,7 +280,7 @@ func DeleteAppliedResources(resources []workapiv1.AppliedManifestResourceMeta, d } // forget this item if the UID does not match the resource UID we previously deleted - if len(resource.UID) > 0 && resource.UID != string(u.GetUID()) { + if waitingForFinalization && resource.UID != string(u.GetUID()) { continue } diff --git a/test/integration/work_test.go b/test/integration/work_test.go index b646dc40a..ce485fe2b 100644 --- a/test/integration/work_test.go +++ b/test/integration/work_test.go @@ -391,7 +391,7 @@ var _ = ginkgo.Describe("ManifestWork", func() { }) ginkgo.Context("Foreground deletion", func() { - var finalizer = "a.b.c/d" + var finalizer = "cluster.open-cluster-management.io/testing" ginkgo.BeforeEach(func() { manifests = []workapiv1.Manifest{ util.ToManifest(util.NewConfigmap(o.SpokeClusterName, "cm1", map[string]string{"a": "b"}, []string{finalizer})),