Skip to content

Commit

Permalink
[YUNIKORN-1867] add priority offset test
Browse files Browse the repository at this point in the history
Signed-off-by: Frank Yang <yangpoan@gmail.com>
  • Loading branch information
FrankYang0529 committed Jul 19, 2023
1 parent aebb1d4 commit 490f3e2
Showing 1 changed file with 79 additions and 0 deletions.
79 changes: 79 additions & 0 deletions test/e2e/priority_scheduling/priority_scheduling_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
"k8s.io/apimachinery/pkg/api/resource"

"github.com/apache/yunikorn-core/pkg/common/configs"
"github.com/apache/yunikorn-core/pkg/scheduler"
"github.com/apache/yunikorn-k8shim/pkg/common/constants"
tests "github.com/apache/yunikorn-k8shim/test/e2e"
"github.com/apache/yunikorn-k8shim/test/e2e/framework/helpers/common"
Expand Down Expand Up @@ -176,6 +177,84 @@ var _ = ginkgo.Describe("PriorityScheduling", func() {
validatePodSchedulingOrder(ns, sleepPodConf, lowPodConf, normalPodConf, highPodConf)
})

ginkgo.It("Verify_Priority_Offset_Queue_App_Scheduling_Order", func() {
By("Setting custom YuniKorn configuration")
annotation = "ann-" + common.RandSeq(10)
yunikorn.UpdateCustomConfigMapWrapper(oldConfigMap, "fifo", annotation, func(sc *configs.SchedulerConfig) error {
// We cannot add child queues to a draining queue (root.fence). Wait for queue cleaning.
time.Sleep(scheduler.DefaultCleanRootInterval + 1*time.Second)

// remove placement rules so we can control queue
sc.Partitions[0].PlacementRules = nil

if err = common.AddQueue(sc, "default", "root", configs.QueueConfig{
Name: "fence",
Parent: true,
Resources: configs.Resources{Max: map[string]string{siCommon.CPU: "100m", siCommon.Memory: "100M"}},
Properties: map[string]string{configs.PriorityPolicy: "fence"},
}); err != nil {
return err
}
if err = common.AddQueue(sc, "default", "root.fence", configs.QueueConfig{
Name: "highpriority",
Properties: map[string]string{configs.PriorityOffset: "100"},
}); err != nil {
return err
}
if err = common.AddQueue(sc, "default", "root.fence", configs.QueueConfig{
Name: "normalpriority",
Properties: map[string]string{configs.PriorityOffset: "0"},
}); err != nil {
return err
}
if err = common.AddQueue(sc, "default", "root.fence", configs.QueueConfig{
Name: "lowpriority",
Properties: map[string]string{configs.PriorityOffset: "-100"},
}); err != nil {
return err
}

return nil
})

sleepPodConf = k8s.TestPodConfig{
Name: "test-sleep-" + common.RandSeq(5),
Labels: map[string]string{
constants.LabelQueueName: "root.fence.highpriority",
constants.LabelApplicationID: "app-sleep-" + common.RandSeq(5)},
Namespace: ns,
Resources: rr,
}

lowPodConf = k8s.TestPodConfig{
Name: "test-low-priority-" + common.RandSeq(5),
Labels: map[string]string{
constants.LabelQueueName: "root.fence.lowpriority",
constants.LabelApplicationID: "app-low-" + common.RandSeq(5)},
Namespace: ns,
Resources: rr,
}

normalPodConf = k8s.TestPodConfig{
Name: "test-normal-priority-" + common.RandSeq(5),
Labels: map[string]string{
constants.LabelQueueName: "root.fence.normalpriority",
constants.LabelApplicationID: "app-normal-" + common.RandSeq(5)},
Resources: rr,
Namespace: ns,
}

highPodConf = k8s.TestPodConfig{
Name: "test-high-priority-" + common.RandSeq(5),
Labels: map[string]string{
constants.LabelQueueName: "root.fence.highpriority",
constants.LabelApplicationID: "app-high-" + common.RandSeq(5)},
Namespace: ns,
Resources: rr,
}
validatePodSchedulingOrder(ns, sleepPodConf, lowPodConf, normalPodConf, highPodConf)
})

ginkgo.AfterEach(func() {
testDescription := ginkgo.CurrentSpecReport()
if testDescription.Failed() {
Expand Down

0 comments on commit 490f3e2

Please sign in to comment.