Skip to content

Commit

Permalink
Merge pull request kubernetes#22958 from jlowdermilk/run-test
Browse files Browse the repository at this point in the history
Auto commit by PR queue bot
  • Loading branch information
k8s-merge-robot committed Mar 15, 2016
2 parents bf1bb5d + c732681 commit a9c17c1
Showing 1 changed file with 43 additions and 4 deletions.
47 changes: 43 additions & 4 deletions test/e2e/kubectl.go
Original file line number Diff line number Diff line change
Expand Up @@ -861,6 +861,48 @@ var _ = Describe("Kubectl client", func() {
})
})

Describe("Kubectl run default", func() {
var nsFlag string
var name string

var cleanUp func()

BeforeEach(func() {
nsFlag = fmt.Sprintf("--namespace=%v", ns)
gte, err := serverVersionGTE(deploymentsVersion, c)
if err != nil {
Failf("Failed to get server version: %v", err)
}
if gte {
name = "e2e-test-nginx-deployment"
cleanUp = func() { runKubectlOrDie("delete", "deployment", name, nsFlag) }
} else {
name = "e2e-test-nginx-rc"
cleanUp = func() { runKubectlOrDie("delete", "rc", name, nsFlag) }
}
})

AfterEach(func() {
cleanUp()
})

It("should create an rc or deployment from an image [Conformance]", func() {
By("running the image " + nginxImage)
runKubectlOrDie("run", name, "--image="+nginxImage, nsFlag)
By("verifying the pod controlled by " + name + " gets created")
label := labels.SelectorFromSet(labels.Set(map[string]string{"run": name}))
podlist, err := waitForPodsWithLabel(c, ns, label)
if err != nil {
Failf("Failed getting pod controlled by %s: %v", name, err)
}
pods := podlist.Items
if pods == nil || len(pods) != 1 || len(pods[0].Spec.Containers) != 1 || pods[0].Spec.Containers[0].Image != nginxImage {
runKubectlOrDie("get", "pods", "-L", "run", nsFlag)
Failf("Failed creating 1 pod with expected image %s. Number of pods = %v", nginxImage, len(pods))
}
})
})

Describe("Kubectl run rc", func() {
var nsFlag string
var rcName string
Expand Down Expand Up @@ -913,7 +955,6 @@ var _ = Describe("Kubectl client", func() {
Failf("Failed getting logs by rc %s: %v", rcName, err)
}
})

})

Describe("Kubectl run deployment", func() {
Expand All @@ -933,7 +974,7 @@ var _ = Describe("Kubectl client", func() {
SkipUnlessServerVersionGTE(deploymentsVersion, c)

By("running the image " + nginxImage)
runKubectlOrDie("run", dName, "--image="+nginxImage, nsFlag)
runKubectlOrDie("run", dName, "--image="+nginxImage, "--generator=deployment/v1beta1", nsFlag)
By("verifying the deployment " + dName + " was created")
d, err := c.Extensions().Deployments(ns).Get(dName)
if err != nil {
Expand All @@ -956,7 +997,6 @@ var _ = Describe("Kubectl client", func() {
Failf("Failed creating 1 pod with expected image %s. Number of pods = %v", nginxImage, len(pods))
}
})

})

Describe("Kubectl run job", func() {
Expand Down Expand Up @@ -1009,7 +1049,6 @@ var _ = Describe("Kubectl client", func() {
Failf("Failed creating a job with correct restart policy for --restart=OnFailure")
}
})

})

Describe("Kubectl run --rm job", func() {
Expand Down

0 comments on commit a9c17c1

Please sign in to comment.