diff --git a/pkg/cache/context.go b/pkg/cache/context.go index 474a1deb9..244b78563 100644 --- a/pkg/cache/context.go +++ b/pkg/cache/context.go @@ -308,7 +308,7 @@ func (ctx *Context) updateYuniKornPod(appID string, pod *v1.Pod) { var app *Application taskID := string(pod.UID) if app = ctx.getApplication(appID); app != nil { - if task, err := app.GetTask(taskID); task != nil && err == nil { + if task := app.GetTask(taskID); task != nil { task.setTaskPod(pod) } } diff --git a/pkg/cache/context_test.go b/pkg/cache/context_test.go index 028bd8173..afc447013 100644 --- a/pkg/cache/context_test.go +++ b/pkg/cache/context_test.go @@ -526,10 +526,9 @@ func TestUpdatePod(t *testing.T) { context.UpdatePod(pod1, pod3) pod = context.schedulerCache.GetPod(uid1) assert.Check(t, pod == nil, "pod still found after termination") - app := context.getApplication("yunikorn-test-00001") + app := context.getApplication(appID1) // ensure that an updated pod is updated inside the Task - task, err := app.GetTask("UID-00001") - assert.NilError(t, err) + task := app.GetTask(uid1) assert.Assert(t, task.GetTaskPod() == pod3, "task pod has not been updated") // ensure a non-terminated pod is updated