DRA: adapt FilterTimeout test after upstream dra_test.go split

This commit is contained in:
Hamza
2026-03-17 11:29:37 +01:00
parent 0680960e5e
commit 3ea232f220
2 changed files with 17 additions and 2 deletions

View File

@@ -133,10 +133,11 @@ profiles:
args:
filterTimeout: 10ms
`)
expectPodUnschedulable(tCtx, pod, "timed out trying to allocate devices")
expectPodSchedulerError(tCtx, pod, "timed out trying to allocate devices")
// Update one slice such that allocation succeeds.
// The scheduler must retry and should succeed now.
// The scheduler retries automatically (timeouts go through
// backoff queue, not unschedulable pool) and should succeed now.
createdOtherSlice.Spec.Devices = append(createdOtherSlice.Spec.Devices, resourceapi.Device{
Name: fmt.Sprintf("dev-%d", devicesPerSlice),
})

View File

@@ -272,6 +272,20 @@ func waitForClaimAllocatedToDevice(tCtx ktesting.TContext, namespace, claimName
)
}
func expectPodSchedulerError(tCtx ktesting.TContext, pod *v1.Pod, reason string) {
tCtx.Helper()
tCtx.ExpectNoError(e2epod.WaitForPodCondition(tCtx, tCtx.Client(), pod.Namespace, pod.Name, v1.PodReasonSchedulerError, time.Minute, func(pod *v1.Pod) (bool, error) {
if pod.Status.Phase == v1.PodPending {
for _, cond := range pod.Status.Conditions {
if cond.Type == v1.PodScheduled && cond.Status == v1.ConditionFalse && cond.Reason == v1.PodReasonSchedulerError && strings.Contains(cond.Message, reason) {
return true, nil
}
}
}
return false, nil
}), fmt.Sprintf("expected pod to have scheduler error because %q", reason))
}
func expectPodUnschedulable(tCtx ktesting.TContext, pod *v1.Pod, reason string) {
tCtx.Helper()
tCtx.ExpectNoError(e2epod.WaitForPodNameUnschedulableInNamespace(tCtx, tCtx.Client(), pod.Name, pod.Namespace), fmt.Sprintf("expected pod to be unschedulable because %q", reason))