Skip to content

Commit

Permalink
[YUNIKORN-2068] E2E Test for Preemption
Browse files Browse the repository at this point in the history
  • Loading branch information
rrajesh-cloudera committed Nov 2, 2023
1 parent 856b629 commit 7e22832
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions test/e2e/preemption/preemption_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ var _ = ginkgo.Describe("Preemption", func() {
annotation = "ann-" + common.RandSeq(10)
yunikorn.UpdateCustomConfigMapWrapper(oldConfigMap, "", annotation, func(sc *configs.SchedulerConfig) error {
// remove placement rules so we can control queue
sc.Partitions[0].PlacementRules = []configs.PlacementRule{{Name: "provided", Value: "namespace", Create: true}}
sc.Partitions[0].PlacementRules = nil
var err error
if err = common.AddQueue(sc, "default", "root", configs.QueueConfig{
Name: "high-priority",
Expand All @@ -587,6 +587,7 @@ var _ = ginkgo.Describe("Preemption", func() {
ginkgo.By("Schedule a number of small, Low priority pause tasks on Low Guaranteed queue (Enough to fill the node)")
sandbox1SleepPodConfigs := createSandbox1SleepPodCofigsWithStaticNode(4, 600)
sleepPod5Config := k8s.SleepPodConfig{Name: "sleepjob5", NS: dev, Mem: sleepPodMemLimit, Time: 600, Optedout: k8s.Allow, Labels: map[string]string{"queue": "root.high-priority"}, RequiredNode: nodeName}
sandbox1SleepPodConfigs = append(sandbox1SleepPodConfigs, sleepPod5Config)
for _, config := range sandbox1SleepPodConfigs {
ginkgo.By("Deploy the sleep pod " + config.Name + " to the development namespace")
sleepObj, podErr := k8s.InitSleepPod(config)
Expand All @@ -595,18 +596,12 @@ var _ = ginkgo.Describe("Preemption", func() {
gomega.Ω(podErr).NotTo(gomega.HaveOccurred())

// Wait for pod to move to running state
podErr = kClient.WaitForPodRunning(dev, sleepRespPod.Name, 60*time.Second)
podErr = kClient.WaitForPodBySelectorRunning(dev,
fmt.Sprintf("app=%s", sleepRespPod.ObjectMeta.Labels["app"]),
60)
gomega.Ω(podErr).NotTo(gomega.HaveOccurred())
}
sleepObj, podErr := k8s.InitSleepPod(sleepPod5Config)
Ω(podErr).NotTo(gomega.HaveOccurred())
sleepRespPod5, err := kClient.CreatePod(sleepObj, dev)
gomega.Ω(err).NotTo(gomega.HaveOccurred())

// Wait for pod to move to running state
podErr = kClient.WaitForPodRunning(dev, sleepRespPod5.Name, 120*time.Second)
gomega.Ω(podErr).NotTo(gomega.HaveOccurred())
// assert two of the pods in root.low-priority are preempted
ginkgo.By("Two pods in root.low-priority queue are preempted")
sandbox1RunningPodsCnt := 0
pods, err := kClient.ListPodsByLabelSelector(dev, "queue=root.low-priority")
Expand Down

0 comments on commit 7e22832

Please sign in to comment.