This is an automated email from the ASF dual-hosted git repository.
pbacsko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/yunikorn-k8shim.git
The following commit(s) were added to refs/heads/master by this push:
new 138d53a5 [ADDENDUM] YUNIKORN-2319] cache.Task: reference to old pod
object is kept after update
138d53a5 is described below
commit 138d53a59a16cf7072f517f1484d4fcb035eb7da
Author: Peter Bacsko <[email protected]>
AuthorDate: Thu Aug 1 12:55:40 2024 +0200
[ADDENDUM] YUNIKORN-2319] cache.Task: reference to old pod object is kept
after update
Fix compilation error
---
pkg/cache/context.go | 2 +-
pkg/cache/context_test.go | 5 ++---
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/pkg/cache/context.go b/pkg/cache/context.go
index 474a1deb..244b7856 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 028bd817..afc44701 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
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]