Skip to content

Commit

Permalink
[YUNIKORN-1867] refactor priority_scheduling_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 17, 2023
1 parent db5e7b6 commit 5e65cc7
Showing 1 changed file with 13 additions and 20 deletions.
33 changes: 13 additions & 20 deletions test/e2e/priority_scheduling/priority_scheduling_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,18 @@ import (
"github.com/apache/yunikorn-k8shim/test/e2e/framework/helpers/common"
"github.com/apache/yunikorn-k8shim/test/e2e/framework/helpers/k8s"
"github.com/apache/yunikorn-k8shim/test/e2e/framework/helpers/yunikorn"
siCommon "github.com/apache/yunikorn-scheduler-interface/lib/go/common"
)

const (
requestCPU = "100m"
requestMem = "100M"
)

var rr = &v1.ResourceRequirements{
Requests: v1.ResourceList{
"cpu": resource.MustParse("100m"),
"memory": resource.MustParse("100M"),
v1.ResourceCPU: resource.MustParse(requestCPU),
v1.ResourceMemory: resource.MustParse(requestMem),
},
}

Expand All @@ -63,8 +69,8 @@ var _ = ginkgo.Describe("Static_Queue_Priority", func() {
if err = common.AddQueue(sc, "default", "root", configs.QueueConfig{
Name: "fence",
Parent: true,
Resources: configs.Resources{Max: map[string]string{"vcore": "100m", "memory": "100M"}},
Properties: map[string]string{"priority.policy": "fence"},
Resources: configs.Resources{Max: map[string]string{siCommon.CPU: requestCPU, siCommon.Memory: requestMem}},
Properties: map[string]string{configs.PriorityPolicy: "fence"},
}); err != nil {
return err
}
Expand All @@ -83,13 +89,6 @@ var _ = ginkgo.Describe("Static_Queue_Priority", func() {
Ω(err).ShouldNot(HaveOccurred())
Ω(namespace.Status.Phase).Should(Equal(v1.NamespaceActive))

rr = &v1.ResourceRequirements{
Requests: v1.ResourceList{
"cpu": resource.MustParse("100m"),
"memory": resource.MustParse("100M"),
},
}

sleepPodConf = k8s.TestPodConfig{
Name: "test-sleep-" + common.RandSeq(5),
Labels: map[string]string{
Expand Down Expand Up @@ -130,7 +129,7 @@ var _ = ginkgo.Describe("Static_Queue_Priority", func() {
}
})

ginkgo.It("Verify_Dynamic_Queue_Scheduling_Order", func() {
ginkgo.It("Verify_Static_Queue_App_Scheduling_Order", func() {
validatePodSchedulingOrder(ns, sleepPodConf, lowPodConf, normalPodConf, highPodConf)
})

Expand Down Expand Up @@ -167,17 +166,11 @@ var _ = ginkgo.Describe("Dynamic_Queue_Priority", func() {

By(fmt.Sprintf("Creating test namespace %s", ns))
namespace, err = kubeClient.CreateNamespace(ns, map[string]string{
constants.NamespaceQuota: "{\"cpu\": \"100m\", \"memory\": \"100M\"}"})
constants.NamespaceQuota: fmt.Sprintf("{\"%s\": \"%s\", \"%s\": \"%s\"}", v1.ResourceCPU, requestCPU, v1.ResourceMemory, requestMem),
})
Ω(err).ShouldNot(HaveOccurred())
Ω(namespace.Status.Phase).Should(Equal(v1.NamespaceActive))

rr = &v1.ResourceRequirements{
Requests: v1.ResourceList{
"cpu": resource.MustParse("100m"),
"memory": resource.MustParse("100M"),
},
}

sleepPodConf = k8s.TestPodConfig{
Name: "test-sleep-" + common.RandSeq(5),
Labels: map[string]string{constants.LabelApplicationID: "app-sleep-" + common.RandSeq(5)},
Expand Down

0 comments on commit 5e65cc7

Please sign in to comment.