Skip to content

Commit 46461a1

Browse files
committed
Added test case for PR.
Signed-off-by: dmatch01 <darroyo@us.ibm.com>
1 parent eef810b commit 46461a1

File tree

2 files changed

+55
-0
lines changed

2 files changed

+55
-0
lines changed

test/e2e/queue.go

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,52 @@ var _ = Describe("AppWrapper E2E Test", func() {
361361
Expect(err).NotTo(HaveOccurred())
362362
})
363363

364+
It("MCAD Scheduling Failure Preemption Test", func() {
365+
fmt.Fprintf(os.Stdout, "[e2e] MCAD Bad Custom Pod Resources vs. Deployment Pod Resource Not Queuing Test - Started.\n")
366+
context := initTestContext()
367+
var appwrappers []*arbv1.AppWrapper
368+
appwrappersPtr := &appwrappers
369+
defer cleanupTestObjectsPtr(context, appwrappersPtr)
370+
371+
// This should fill up the worker node and most of the master node
372+
aw := createDeploymentAWwith550CPU(context, "aw-deployment-2-550cpu")
373+
appwrappers = append(appwrappers, aw)
374+
375+
err := waitAWPodsReady(context, aw)
376+
Expect(err).NotTo(HaveOccurred())
377+
378+
// This should not fit on any node but should dispatch because there is enough aggregated resources.
379+
aw2 := createGenericDeploymentCustomPodResourcesWithCPUAW(
380+
context, "aw-deployment-1-700-cpu", "700m", "700m", 1)
381+
382+
appwrappers = append(appwrappers, aw2)
383+
384+
err = waitAWAnyPodsExists(context, aw2)
385+
Expect(err).NotTo(HaveOccurred())
386+
387+
err = waitAWPodsPending(context, aw2)
388+
Expect(err).NotTo(HaveOccurred())
389+
390+
// This should fit on cluster after AW aw-deployment-1-700-cpu above is automatically preempted on
391+
// scheduling failure
392+
aw3 := createGenericDeploymentCustomPodResourcesWithCPUAW(
393+
context, "aw-deployment-2-425-cpu", "425m", "425m", 2)
394+
395+
appwrappers = append(appwrappers, aw3)
396+
397+
// Wait for pods to get created, assumes preemption around 1 minute
398+
err = waitAWPodsExists(context, aw3, 120000*time.Millisecond)
399+
Expect(err).NotTo(HaveOccurred())
400+
401+
// Make sure they are running
402+
err = waitAWPodsReady(context, aw3)
403+
Expect(err).NotTo(HaveOccurred())
404+
405+
// Make sure pods from AW aw-deployment-1-700-cpu above do not exist proving preemption
406+
err = waitAWAnyPodsExists(context, aw2)
407+
Expect(err).To(HaveOccurred())
408+
409+
})
364410

365411
It("MCAD Bad Custom Pod Resources vs. Deployment Pod Resource Not Queuing Test", func() {
366412
fmt.Fprintf(os.Stdout, "[e2e] MCAD Bad Custom Pod Resources vs. Deployment Pod Resource Not Queuing Test - Started.\n")

test/e2e/util.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,15 @@ func waitAWPodsReadyEx(ctx *context, aw *arbv1.AppWrapper, taskNum int, quite bo
643643
[]v1.PodPhase{v1.PodRunning, v1.PodSucceeded}, taskNum, quite))
644644
}
645645

646+
func waitAWPodsPending(ctx *context, aw *arbv1.AppWrapper) error {
647+
return waitAWPodsPendingEx(ctx, aw, int(aw.Spec.SchedSpec.MinAvailable), false)
648+
}
649+
650+
func waitAWPodsPendingEx(ctx *context, aw *arbv1.AppWrapper, taskNum int, quite bool) error {
651+
return wait.Poll(100*time.Millisecond, ninetySeconds, awPodPhase(ctx, aw,
652+
[]v1.PodPhase{v1.PodPending}, taskNum, quite))
653+
}
654+
646655
func waitAWPodsTerminatedEx(ctx *context, namespace string, name string, pods []*v1.Pod, taskNum int) error {
647656
return waitAWPodsTerminatedExVerbose(ctx, namespace, name, pods, taskNum, true)
648657
}

0 commit comments

Comments
 (0)