mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-07-18 04:54:54 +00:00
DRA: adapt FilterTimeout test after upstream dra_test.go split
This commit is contained in:
@@ -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),
|
||||
})
|
||||
|
||||
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user