Skip to content

Commit

Permalink
Fix debug issue
Browse files Browse the repository at this point in the history
  • Loading branch information
TommyLike committed Mar 22, 2019
1 parent a6d467e commit 596c35b
Show file tree
Hide file tree
Showing 3 changed files with 197 additions and 7 deletions.
8 changes: 4 additions & 4 deletions installer/chart/volcano/templates/scheduler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,13 @@ spec:
image: {{.Values.basic.scheduler_image_name}}:{{.Values.basic.image_tag_version}}
args:
- --alsologtostderr
- --scheduler-conf=/volcano.scheduler/kube-batch-conf.yaml
- -v=2
- --scheduler-conf=/volcano.scheduler/kube-batch.conf
- -v=3
- 2>&1
imagePullPolicy: "IfNotPresent"
volumeMounts:
-name: scheduler-config
mountPath: /volcano.scheduler
- name: scheduler-config
mountPath: /volcano.scheduler
volumes:
- name: scheduler-config
configMap:
Expand Down
196 changes: 193 additions & 3 deletions test/e2e/job_scheduling.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,134 @@ limitations under the License.
package e2e

import (
"time"

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)

var _ = Describe("Job E2E Test", func() {
It("Schedule Job", func() {
context := initTestContext()
defer cleanupTestContext(context)
rep := clusterSize(context, oneCPU)

job := createJob(context, &jobSpec{
name: "qj-1",
tasks: []taskSpec{
{
img: defaultBusyBoxImage,
req: oneCPU,
min: 2,
rep: rep,
},
},
})

err := waitJobReady(context, job)
Expect(err).NotTo(HaveOccurred())
})

It("Schedule Multiple Jobs", func() {
context := initTestContext()
defer cleanupTestContext(context)

rep := clusterSize(context, oneCPU)

job := &jobSpec{
tasks: []taskSpec{
{
img: defaultBusyBoxImage,
req: oneCPU,
min: 2,
rep: rep,
},
},
}

job.name = "mqj-1"
job1 := createJob(context, job)
job.name = "mqj-2"
job2 := createJob(context, job)
job.name = "mqj-3"
job3 := createJob(context, job)

err := waitJobReady(context, job1)
Expect(err).NotTo(HaveOccurred())

err = waitJobReady(context, job2)
Expect(err).NotTo(HaveOccurred())

err = waitJobReady(context, job3)
Expect(err).NotTo(HaveOccurred())
})

It("Gang scheduling", func() {
context := initTestContext()
defer cleanupTestContext(context)
rep := clusterSize(context, oneCPU)/2 + 1

replicaset := createReplicaSet(context, "rs-1", rep, defaultNginxImage, oneCPU)
err := waitReplicaSetReady(context, replicaset.Name)
Expect(err).NotTo(HaveOccurred())

jobSpec := &jobSpec{
name: "gang-qj",
namespace: "test",
tasks: []taskSpec{
{
img: defaultBusyBoxImage,
req: oneCPU,
min: rep,
rep: rep,
},
},
}

job := createJob(context, jobSpec)
err = waitJobPending(context, job)
Expect(err).NotTo(HaveOccurred())

err = waitJobUnschedulable(context, job)
Expect(err).NotTo(HaveOccurred())

err = deleteReplicaSet(context, replicaset.Name)
Expect(err).NotTo(HaveOccurred())

err = waitJobReady(context, job)
Expect(err).NotTo(HaveOccurred())
})

It("Gang scheduling: Full Occupied", func() {
context := initTestContext()
defer cleanupTestContext(context)
rep := clusterSize(context, oneCPU)

job := &jobSpec{
namespace: "test",
tasks: []taskSpec{
{
img: defaultNginxImage,
req: oneCPU,
min: rep,
rep: rep,
},
},
}

job.name = "gang-fq-qj1"
job1 := createJob(context, job)
err := waitJobReady(context, job1)
Expect(err).NotTo(HaveOccurred())

job.name = "gang-fq-qj2"
job2 := createJob(context, job)
err = waitJobPending(context, job2)
Expect(err).NotTo(HaveOccurred())

err = waitJobReady(context, job1)
Expect(err).NotTo(HaveOccurred())
})

It("Preemption", func() {
context := initTestContext()
Expand Down Expand Up @@ -73,16 +196,16 @@ var _ = Describe("Job E2E Test", func() {
},
}

job.name = "preemptee-qj"
job.name = "multipreemptee-qj"
job1 := createJob(context, job)
err := waitTasksReady(context, job1, int(rep))
Expect(err).NotTo(HaveOccurred())

job.name = "preemptor-qj1"
job.name = "multipreemptor-qj1"
job2 := createJob(context, job)
Expect(err).NotTo(HaveOccurred())

job.name = "preemptor-qj2"
job.name = "multipreemptor-qj2"
job3 := createJob(context, job)
Expect(err).NotTo(HaveOccurred())

Expand All @@ -95,4 +218,71 @@ var _ = Describe("Job E2E Test", func() {
err = waitTasksReady(context, job3, int(rep)/3)
Expect(err).NotTo(HaveOccurred())
})

It("Schedule BestEffort Job", func() {
context := initTestContext()
defer cleanupTestContext(context)

slot := oneCPU
rep := clusterSize(context, slot)

spec := &jobSpec{
name: "test",
tasks: []taskSpec{
{
img: defaultNginxImage,
req: slot,
min: 2,
rep: rep,
},
{
img: defaultNginxImage,
min: 2,
rep: rep / 2,
},
},
}

job := createJob(context, spec)

err := waitJobReady(context, job)
Expect(err).NotTo(HaveOccurred())
})

It("Statement", func() {
context := initTestContext()
defer cleanupTestContext(context)

slot := oneCPU
rep := clusterSize(context, slot)

spec := &jobSpec{
namespace: "test",
tasks: []taskSpec{
{
img: defaultNginxImage,
req: slot,
min: rep,
rep: rep,
},
},
}

spec.name = "st-qj-1"
job1 := createJob(context, spec)
err := waitJobReady(context, job1)
Expect(err).NotTo(HaveOccurred())

now := time.Now()

spec.name = "st-qj-2"
job2 := createJob(context, spec)
err = waitJobUnschedulable(context, job2)
Expect(err).NotTo(HaveOccurred())

// No preemption event
evicted, err := jobEvicted(context, job1, now)()
Expect(err).NotTo(HaveOccurred())
Expect(evicted).NotTo(BeTrue())
})
})

0 comments on commit 596c35b

Please sign in to comment.