Skip to content

Commit c6a79a0

Browse files
committed
add ids in the apply task into taskContext
1 parent b9ff655 commit c6a79a0

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

pkg/apply/task/apply_task.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ func (a *ApplyTask) Start(taskContext *taskrunner.TaskContext) {
137137
continue
138138
}
139139
}
140+
infos = append(infos, info)
140141
canApply, err := inventory.CanApply(a.InvInfo, clusterObj, a.InventoryPolicy)
141142
if !canApply {
142143
taskContext.EventChannel() <- createApplyEvent(
@@ -147,7 +148,6 @@ func (a *ApplyTask) Start(taskContext *taskrunner.TaskContext) {
147148
}
148149
// add the inventory annotation to the resource being applied.
149150
inventory.AddInventoryIDAnnotation(obj, a.InvInfo)
150-
infos = append(infos, info)
151151
ao.SetObjects([]*resource.Info{info})
152152
err = ao.Run()
153153
if err != nil {

pkg/apply/task/apply_task_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,8 @@ func TestApplyTaskWithDifferentInventoryAnnotation(t *testing.T) {
611611
assert.Equal(t, tc.expectedEvents[i].Type, e.Type)
612612
assert.Equal(t, tc.expectedEvents[i].ApplyEvent.Error.Error(), e.ApplyEvent.Error.Error())
613613
}
614+
actualUids := taskContext.AllResourceUIDs()
615+
assert.Equal(t, len(actualUids), 1)
614616
})
615617
}
616618
}

0 commit comments

Comments
 (0)