diff --git a/pkg/apply/task/apply_task.go b/pkg/apply/task/apply_task.go index 15f22a1..10b43b9 100644 --- a/pkg/apply/task/apply_task.go +++ b/pkg/apply/task/apply_task.go @@ -137,6 +137,7 @@ func (a *ApplyTask) Start(taskContext *taskrunner.TaskContext) { continue } } + infos = append(infos, info) canApply, err := inventory.CanApply(a.InvInfo, clusterObj, a.InventoryPolicy) if !canApply { taskContext.EventChannel() <- createApplyEvent( @@ -147,7 +148,6 @@ func (a *ApplyTask) Start(taskContext *taskrunner.TaskContext) { } // add the inventory annotation to the resource being applied. inventory.AddInventoryIDAnnotation(obj, a.InvInfo) - infos = append(infos, info) ao.SetObjects([]*resource.Info{info}) err = ao.Run() if err != nil { diff --git a/pkg/apply/task/apply_task_test.go b/pkg/apply/task/apply_task_test.go index a6fb49e..91fca5f 100644 --- a/pkg/apply/task/apply_task_test.go +++ b/pkg/apply/task/apply_task_test.go @@ -611,6 +611,8 @@ 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() + assert.Equal(t, len(actualUids), 1) }) } }