diff --git a/pkg/apply/task/apply_task_test.go b/pkg/apply/task/apply_task_test.go index c92a0b6..ac6d21a 100644 --- a/pkg/apply/task/apply_task_test.go +++ b/pkg/apply/task/apply_task_test.go @@ -837,7 +837,7 @@ func TestApplyTaskWithDifferentInventoryAnnotation(t *testing.T) { assert.Equal(t, tc.expectedEvents[i].Type, e.Type) assert.Equal(t, tc.expectedEvents[i].ApplyEvent.Error.Error(), e.ApplyEvent.Error.Error()) } - actualUids := taskContext.AllResourceUIDs() + actualUids := taskContext.AppliedResourceUIDs() assert.Equal(t, len(actualUids), 1) }) } diff --git a/pkg/apply/task/prune_task.go b/pkg/apply/task/prune_task.go index 10e8763..a63f08a 100644 --- a/pkg/apply/task/prune_task.go +++ b/pkg/apply/task/prune_task.go @@ -52,7 +52,7 @@ func (p *PruneTask) Start(taskContext *taskrunner.TaskContext) { // Create filter to prevent deletion of currently applied // objects. Must be done here to wait for applied UIDs. uidFilter := filter.CurrentUIDFilter{ - CurrentUIDs: taskContext.AllResourceUIDs(), + CurrentUIDs: taskContext.AppliedResourceUIDs(), } p.Filters = append(p.Filters, uidFilter) err := p.PruneOptions.Prune(p.Objects, diff --git a/pkg/apply/taskrunner/context.go b/pkg/apply/taskrunner/context.go index e530e86..66a45a8 100644 --- a/pkg/apply/taskrunner/context.go +++ b/pkg/apply/taskrunner/context.go @@ -76,9 +76,9 @@ func (tc *TaskContext) AppliedResources() []object.ObjMetadata { return all } -// AllResourceUIDs returns a set with the UIDs of all the resources in the -// context. -func (tc *TaskContext) AllResourceUIDs() sets.String { +// AppliedResourceUIDs returns a set with the UIDs of all the +// successfully applied resources. +func (tc *TaskContext) AppliedResourceUIDs() sets.String { uids := sets.NewString() for _, ai := range tc.appliedResources { uid := strings.TrimSpace(string(ai.uid))