Skip to content

Commit ddb2f1f

Browse files
Fix flaky RecoveryTimeout e2e test
Signed-off-by: Sohan Kunkerkar <[email protected]>
1 parent 50d89e0 commit ddb2f1f

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

test/e2e/customconfigs/waitforpodsready_test.go

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,9 @@ var _ = ginkgo.Describe("WaitForPodsReady with default Timeout and a tiny Recove
242242
RequeuingStrategy: &configapi.RequeuingStrategy{
243243
Timestamp: ptr.To(configapi.EvictionTimestamp),
244244
BackoffBaseSeconds: ptr.To(int32(1)),
245-
BackoffLimitCount: ptr.To(int32(1)),
245+
// Allow at least one requeue cycle before deactivation so the test
246+
// can verify the requeue behavior.
247+
BackoffLimitCount: ptr.To(int32(2)),
246248
},
247249
}
248250
})
@@ -322,18 +324,17 @@ var _ = ginkgo.Describe("WaitForPodsReady with default Timeout and a tiny Recove
322324
gomega.Eventually(func(g gomega.Gomega) {
323325
g.Expect(k8sClient.Get(ctx, wlKey, &wl)).Should(gomega.Succeed())
324326
g.Expect(wl.Status.RequeueState).ShouldNot(gomega.BeNil())
325-
g.Expect(*wl.Status.RequeueState.Count).To(gomega.Equal(int32(1)))
327+
// With a tiny RecoveryTimeout (10ms), multiple evictions may occur
328+
// before pods become Ready, so we check for at least 1 eviction.
329+
g.Expect(*wl.Status.RequeueState.Count).To(gomega.BeNumerically(">=", int32(1)))
326330
g.Expect(wl.Status.Conditions).To(utiltesting.HaveConditionStatusTrueAndReason(kueue.WorkloadPodsReady, kueue.WorkloadStarted))
327331
g.Expect(wl.Status.Conditions).To(utiltesting.HaveConditionStatusFalse(kueue.WorkloadEvicted))
328332
g.Expect(wl.Status.Conditions).To(utiltesting.HaveConditionStatusTrue(kueue.WorkloadRequeued))
329333

330-
g.Expect(wl.Status.SchedulingStats.Evictions).To(
331-
gomega.BeComparableTo([]kueue.WorkloadSchedulingStatsEviction{{
332-
Reason: kueue.WorkloadEvictedByPodsReadyTimeout,
333-
UnderlyingCause: kueue.WorkloadWaitForRecovery,
334-
Count: 1,
335-
}}),
336-
)
334+
g.Expect(wl.Status.SchedulingStats.Evictions).To(gomega.HaveLen(1))
335+
g.Expect(wl.Status.SchedulingStats.Evictions[0].Reason).To(gomega.Equal(kueue.WorkloadEvictedByPodsReadyTimeout))
336+
g.Expect(string(wl.Status.SchedulingStats.Evictions[0].UnderlyingCause)).To(gomega.Equal(kueue.WorkloadWaitForRecovery))
337+
g.Expect(wl.Status.SchedulingStats.Evictions[0].Count).To(gomega.BeNumerically(">=", int32(1)))
337338
}, util.LongTimeout, util.Interval).Should(gomega.Succeed())
338339
})
339340

0 commit comments

Comments
 (0)