Skip to content

Commit

Permalink
Add E2E for check functionality of all Plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
thandayuthapani committed Jul 29, 2019
1 parent 7e8fec6 commit 2c85967
Showing 1 changed file with 67 additions and 0 deletions.
67 changes: 67 additions & 0 deletions test/e2e/job_plugins.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/kubernetes/pkg/scheduler/api"
"volcano.sh/volcano/pkg/controllers/job/helpers"
"volcano.sh/volcano/pkg/controllers/job/plugins/env"
)

var _ = Describe("Job E2E Test: Test Job Plugins", func() {
Expand Down Expand Up @@ -170,4 +171,70 @@ var _ = Describe("Job E2E Test: Test Job Plugins", func() {
Expect(pod.Spec.NodeName).To(Equal(nodeName))
}
})

It("Check Functionality of all plugins", func() {
jobName := "job-with-all-plugin"
namespace := "test"
taskName := "task"
foundVolume := false
foundEnv := false
context := initTestContext()
defer cleanupTestContext(context)

_, rep := computeNode(context, oneCPU)
Expect(rep).NotTo(Equal(0))

job := createJob(context, &jobSpec{
namespace: namespace,
name: jobName,
plugins: map[string][]string{
"ssh": {"--no-root"},
"env": {},
"svc": {},
},
tasks: []taskSpec{
{
img: defaultNginxImage,
req: oneCPU,
min: 1,
rep: rep,
name: taskName,
},
},
})

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

pluginName := fmt.Sprintf("%s-ssh", jobName)
_, err = context.kubeclient.CoreV1().ConfigMaps(namespace).Get(
pluginName, v1.GetOptions{})
Expect(err).NotTo(HaveOccurred())

pod, err := context.kubeclient.CoreV1().Pods(namespace).Get(
fmt.Sprintf(helpers.PodNameFmt, jobName, taskName, 0), v1.GetOptions{})
Expect(err).NotTo(HaveOccurred())
for _, volume := range pod.Spec.Volumes {
if volume.Name == pluginName {
foundVolume = true
break
}
}
Expect(foundVolume).To(BeTrue())

// Check whether env exists in the pod
for _, container := range pod.Spec.Containers {
for _, envi := range container.Env {
if envi.Name == env.TaskVkIndex {
foundEnv = true
break
}
}
}
Expect(foundEnv).To(BeTrue())

// Check whether service is created with job name
_, err = context.kubeclient.CoreV1().Services(job.Namespace).Get(job.Name, v1.GetOptions{})
Expect(err).NotTo(HaveOccurred())
})
})

0 comments on commit 2c85967

Please sign in to comment.