diff --git a/test/e2e/queue.go b/test/e2e/queue.go index be95bb711a..9921592968 100644 --- a/test/e2e/queue.go +++ b/test/e2e/queue.go @@ -43,7 +43,7 @@ var _ = Describe("Queue E2E Test", func() { } spec.name = "q1-qj-1" - spec.queue = "q1" + spec.queue = defaultQueue1 job1 := createJob(context, spec) err := waitJobReady(context, job1) Expect(err).NotTo(HaveOccurred()) @@ -58,7 +58,7 @@ var _ = Describe("Queue E2E Test", func() { } spec.name = "q2-qj-2" - spec.queue = "q2" + spec.queue = defaultQueue2 job2 := createJob(context, spec) err = waitTasksReady(context, job2, expected) Expect(err).NotTo(HaveOccurred()) diff --git a/test/e2e/util.go b/test/e2e/util.go index c90ac521f3..a8a33a67ca 100644 --- a/test/e2e/util.go +++ b/test/e2e/util.go @@ -48,11 +48,11 @@ import ( "volcano.sh/volcano/pkg/controllers/job/state" ) -var oneMinute = 1 * time.Minute - -var twoMinute = 2 * time.Minute - -var oneCPU = v1.ResourceList{"cpu": resource.MustParse("1000m")} +var ( + oneMinute = 1 * time.Minute + twoMinute = 2 * time.Minute + oneCPU = v1.ResourceList{"cpu": resource.MustParse("1000m")} +) const ( workerPriority = "worker-pri" @@ -60,6 +60,10 @@ const ( defaultNginxImage = "nginx:1.14" defaultBusyBoxImage = "busybox:1.24" defaultMPIImage = "volcanosh/example-mpi:0.0.1" + + defaultNamespace = "test" + defaultQueue1 = "q1" + defaultQueue2 = "q2" ) func cpuResource(request string) v1.ResourceList { @@ -99,15 +103,14 @@ type context struct { kbclient *kbver.Clientset vkclient *vkver.Clientset - namespace string - queues []string - enableNamespaceAsQueue bool + namespace string + queues []string } func initTestContext() *context { cxt := &context{ - namespace: "test", - queues: []string{"q1", "q2"}, + namespace: defaultNamespace, + queues: []string{defaultQueue1, defaultQueue2}, } home := homeDir() @@ -129,10 +132,6 @@ func initTestContext() *context { Expect(err).NotTo(HaveOccurred(), "k8s cluster is required to have one ready worker node at least.") - //NOTE(tommylikehu):NamespaceAsQueue feature was removed from kube-batch, - //we will eventually remove this logic in test as well. - cxt.enableNamespaceAsQueue = false - _, err = cxt.kubeclient.CoreV1().Namespaces().Create(&v1.Namespace{ ObjectMeta: metav1.ObjectMeta{ Name: cxt.namespace, @@ -177,12 +176,7 @@ func queueNotExist(ctx *context) wait.ConditionFunc { return func() (bool, error) { for _, q := range ctx.queues { var err error - if ctx.enableNamespaceAsQueue { - _, err = ctx.kubeclient.CoreV1().Namespaces().Get(q, metav1.GetOptions{}) - } else { - _, err = ctx.kbclient.SchedulingV1alpha1().Queues().Get(q, metav1.GetOptions{}) - } - + _, err = ctx.kbclient.SchedulingV1alpha1().Queues().Get(q, metav1.GetOptions{}) if !(err != nil && errors.IsNotFound(err)) { return false, err } @@ -234,22 +228,14 @@ func createQueues(cxt *context) { var err error for _, q := range cxt.queues { - if cxt.enableNamespaceAsQueue { - _, err = cxt.kubeclient.CoreV1().Namespaces().Create(&v1.Namespace{ - ObjectMeta: metav1.ObjectMeta{ - Name: q, - }, - }) - } else { - _, err = cxt.kbclient.SchedulingV1alpha1().Queues().Create(&kbv1.Queue{ - ObjectMeta: metav1.ObjectMeta{ - Name: q, - }, - Spec: kbv1.QueueSpec{ - Weight: 1, - }, - }) - } + _, err = cxt.kbclient.SchedulingV1alpha1().Queues().Create(&kbv1.Queue{ + ObjectMeta: metav1.ObjectMeta{ + Name: q, + }, + Spec: kbv1.QueueSpec{ + Weight: 1, + }, + }) Expect(err).NotTo(HaveOccurred()) } @@ -259,17 +245,9 @@ func deleteQueues(cxt *context) { foreground := metav1.DeletePropagationForeground for _, q := range cxt.queues { - var err error - - if cxt.enableNamespaceAsQueue { - err = cxt.kubeclient.CoreV1().Namespaces().Delete(q, &metav1.DeleteOptions{ - PropagationPolicy: &foreground, - }) - } else { - err = cxt.kbclient.SchedulingV1alpha1().Queues().Delete(q, &metav1.DeleteOptions{ - PropagationPolicy: &foreground, - }) - } + err := cxt.kbclient.SchedulingV1alpha1().Queues().Delete(q, &metav1.DeleteOptions{ + PropagationPolicy: &foreground, + }) Expect(err).NotTo(HaveOccurred()) } @@ -305,12 +283,6 @@ func getNS(context *context, job *jobSpec) string { return job.namespace } - if context.enableNamespaceAsQueue { - if len(job.queue) != 0 { - return job.queue - } - } - return context.namespace }