Skip to content

Commit 2130ed9

Browse files
committed
Add unit test for second-pass queue cleanup
1 parent 4a14fc8 commit 2130ed9

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

pkg/cache/queue/manager_test.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1436,6 +1436,16 @@ func TestQueueSecondPassIfNeeded(t *testing.T) {
14361436
passTime: time.Second,
14371437
wantReady: sets.New(workload.NewReference("default", "second")),
14381438
},
1439+
"workload no longer needs second pass after first iteration": {
1440+
workloads: []*kueue.Workload{
1441+
baseWorkloadNeedingSecondPass.DeepCopy(),
1442+
},
1443+
passTime: time.Second,
1444+
wantReady: sets.New[workload.Reference](),
1445+
1446+
},
1447+
1448+
14391449
}
14401450
for name, tc := range cases {
14411451
t.Run(name, func(t *testing.T) {
@@ -1449,6 +1459,13 @@ func TestQueueSecondPassIfNeeded(t *testing.T) {
14491459
for _, wl := range tc.workloads {
14501460
manager.QueueSecondPassIfNeeded(ctx, wl, 0)
14511461
}
1462+
if name == "workload no longer needs second pass after first iteration" {
1463+
manager.QueueSecondPassIfNeeded(
1464+
ctx,
1465+
baseWorkloadNotNeedingSecondPass.DeepCopy(),
1466+
1,
1467+
)
1468+
}
14521469
for _, wl := range tc.deleted.UnsortedList() {
14531470
manager.secondPassQueue.deleteByKey(wl)
14541471
}

0 commit comments

Comments
 (0)