Skip to content

Commit

Permalink
[ADDENDUM] YUNIKORN-2319] cache.Task: reference to old pod object is …
Browse files Browse the repository at this point in the history
…kept after update

Fix compilation error
  • Loading branch information
pbacsko committed Aug 1, 2024
1 parent 26443bc commit 138d53a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pkg/cache/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down
5 changes: 2 additions & 3 deletions pkg/cache/context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 138d53a

Please sign in to comment.