mirror of https://github.com/k3s-io/k3s
e2e: change the tests to use versioned image nginx:1.7.9
parent
c031697848
commit
a66a60bc37
|
@ -72,6 +72,7 @@ const (
|
||||||
nginxDefaultOutput = "Welcome to nginx!"
|
nginxDefaultOutput = "Welcome to nginx!"
|
||||||
simplePodPort = 80
|
simplePodPort = 80
|
||||||
runJobTimeout = 5 * time.Minute
|
runJobTimeout = 5 * time.Minute
|
||||||
|
nginxImage = "gcr.io/google_containers/nginx:1.7.9"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -874,18 +875,16 @@ var _ = Describe("Kubectl client", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should create an rc from an image [Conformance]", func() {
|
It("should create an rc from an image [Conformance]", func() {
|
||||||
image := "nginx"
|
By("running the image " + nginxImage)
|
||||||
|
runKubectlOrDie("run", rcName, "--image="+nginxImage, "--generator=run/v1", nsFlag)
|
||||||
By("running the image " + image)
|
|
||||||
runKubectlOrDie("run", rcName, "--image="+image, "--generator=run/v1", nsFlag)
|
|
||||||
By("verifying the rc " + rcName + " was created")
|
By("verifying the rc " + rcName + " was created")
|
||||||
rc, err := c.ReplicationControllers(ns).Get(rcName)
|
rc, err := c.ReplicationControllers(ns).Get(rcName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Failf("Failed getting rc %s: %v", rcName, err)
|
Failf("Failed getting rc %s: %v", rcName, err)
|
||||||
}
|
}
|
||||||
containers := rc.Spec.Template.Spec.Containers
|
containers := rc.Spec.Template.Spec.Containers
|
||||||
if containers == nil || len(containers) != 1 || containers[0].Image != image {
|
if containers == nil || len(containers) != 1 || containers[0].Image != nginxImage {
|
||||||
Failf("Failed creating rc %s for 1 pod with expected image %s", rcName, image)
|
Failf("Failed creating rc %s for 1 pod with expected image %s", rcName, nginxImage)
|
||||||
}
|
}
|
||||||
|
|
||||||
By("verifying the pod controlled by rc " + rcName + " was created")
|
By("verifying the pod controlled by rc " + rcName + " was created")
|
||||||
|
@ -895,9 +894,9 @@ var _ = Describe("Kubectl client", func() {
|
||||||
Failf("Failed getting pod controlled by rc %s: %v", rcName, err)
|
Failf("Failed getting pod controlled by rc %s: %v", rcName, err)
|
||||||
}
|
}
|
||||||
pods := podlist.Items
|
pods := podlist.Items
|
||||||
if pods == nil || len(pods) != 1 || len(pods[0].Spec.Containers) != 1 || pods[0].Spec.Containers[0].Image != image {
|
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)
|
runKubectlOrDie("get", "pods", "-L", "run", nsFlag)
|
||||||
Failf("Failed creating 1 pod with expected image %s. Number of pods = %v", image, len(pods))
|
Failf("Failed creating 1 pod with expected image %s. Number of pods = %v", nginxImage, len(pods))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -919,18 +918,16 @@ var _ = Describe("Kubectl client", func() {
|
||||||
It("should create a deployment from an image [Conformance]", func() {
|
It("should create a deployment from an image [Conformance]", func() {
|
||||||
SkipUnlessServerVersionGTE(deploymentsVersion, c)
|
SkipUnlessServerVersionGTE(deploymentsVersion, c)
|
||||||
|
|
||||||
image := "nginx"
|
By("running the image " + nginxImage)
|
||||||
|
runKubectlOrDie("run", dName, "--image="+nginxImage, nsFlag)
|
||||||
By("running the image " + image)
|
|
||||||
runKubectlOrDie("run", dName, "--image="+image, nsFlag)
|
|
||||||
By("verifying the deployment " + dName + " was created")
|
By("verifying the deployment " + dName + " was created")
|
||||||
d, err := c.Extensions().Deployments(ns).Get(dName)
|
d, err := c.Extensions().Deployments(ns).Get(dName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Failf("Failed getting deployment %s: %v", dName, err)
|
Failf("Failed getting deployment %s: %v", dName, err)
|
||||||
}
|
}
|
||||||
containers := d.Spec.Template.Spec.Containers
|
containers := d.Spec.Template.Spec.Containers
|
||||||
if containers == nil || len(containers) != 1 || containers[0].Image != image {
|
if containers == nil || len(containers) != 1 || containers[0].Image != nginxImage {
|
||||||
Failf("Failed creating deployment %s for 1 pod with expected image %s", dName, image)
|
Failf("Failed creating deployment %s for 1 pod with expected image %s", dName, nginxImage)
|
||||||
}
|
}
|
||||||
|
|
||||||
By("verifying the pod controlled by deployment " + dName + " was created")
|
By("verifying the pod controlled by deployment " + dName + " was created")
|
||||||
|
@ -940,9 +937,9 @@ var _ = Describe("Kubectl client", func() {
|
||||||
Failf("Failed getting pod controlled by deployment %s: %v", dName, err)
|
Failf("Failed getting pod controlled by deployment %s: %v", dName, err)
|
||||||
}
|
}
|
||||||
pods := podlist.Items
|
pods := podlist.Items
|
||||||
if pods == nil || len(pods) != 1 || len(pods[0].Spec.Containers) != 1 || pods[0].Spec.Containers[0].Image != image {
|
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)
|
runKubectlOrDie("get", "pods", "-L", "run", nsFlag)
|
||||||
Failf("Failed creating 1 pod with expected image %s. Number of pods = %v", image, len(pods))
|
Failf("Failed creating 1 pod with expected image %s. Number of pods = %v", nginxImage, len(pods))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -964,18 +961,16 @@ var _ = Describe("Kubectl client", func() {
|
||||||
It("should create a job from an image when restart is OnFailure [Conformance]", func() {
|
It("should create a job from an image when restart is OnFailure [Conformance]", func() {
|
||||||
SkipUnlessServerVersionGTE(jobsVersion, c)
|
SkipUnlessServerVersionGTE(jobsVersion, c)
|
||||||
|
|
||||||
image := "nginx"
|
By("running the image " + nginxImage)
|
||||||
|
runKubectlOrDie("run", jobName, "--restart=OnFailure", "--image="+nginxImage, nsFlag)
|
||||||
By("running the image " + image)
|
|
||||||
runKubectlOrDie("run", jobName, "--restart=OnFailure", "--image="+image, nsFlag)
|
|
||||||
By("verifying the job " + jobName + " was created")
|
By("verifying the job " + jobName + " was created")
|
||||||
job, err := c.Extensions().Jobs(ns).Get(jobName)
|
job, err := c.Extensions().Jobs(ns).Get(jobName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Failf("Failed getting job %s: %v", jobName, err)
|
Failf("Failed getting job %s: %v", jobName, err)
|
||||||
}
|
}
|
||||||
containers := job.Spec.Template.Spec.Containers
|
containers := job.Spec.Template.Spec.Containers
|
||||||
if containers == nil || len(containers) != 1 || containers[0].Image != image {
|
if containers == nil || len(containers) != 1 || containers[0].Image != nginxImage {
|
||||||
Failf("Failed creating job %s for 1 pod with expected image %s", jobName, image)
|
Failf("Failed creating job %s for 1 pod with expected image %s", jobName, nginxImage)
|
||||||
}
|
}
|
||||||
if job.Spec.Template.Spec.RestartPolicy != api.RestartPolicyOnFailure {
|
if job.Spec.Template.Spec.RestartPolicy != api.RestartPolicyOnFailure {
|
||||||
Failf("Failed creating a job with correct restart policy for --restart=OnFailure")
|
Failf("Failed creating a job with correct restart policy for --restart=OnFailure")
|
||||||
|
@ -985,18 +980,16 @@ var _ = Describe("Kubectl client", func() {
|
||||||
It("should create a job from an image when restart is Never [Conformance]", func() {
|
It("should create a job from an image when restart is Never [Conformance]", func() {
|
||||||
SkipUnlessServerVersionGTE(jobsVersion, c)
|
SkipUnlessServerVersionGTE(jobsVersion, c)
|
||||||
|
|
||||||
image := "nginx"
|
By("running the image " + nginxImage)
|
||||||
|
runKubectlOrDie("run", jobName, "--restart=Never", "--image="+nginxImage, nsFlag)
|
||||||
By("running the image " + image)
|
|
||||||
runKubectlOrDie("run", jobName, "--restart=Never", "--image="+image, nsFlag)
|
|
||||||
By("verifying the job " + jobName + " was created")
|
By("verifying the job " + jobName + " was created")
|
||||||
job, err := c.Extensions().Jobs(ns).Get(jobName)
|
job, err := c.Extensions().Jobs(ns).Get(jobName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Failf("Failed getting job %s: %v", jobName, err)
|
Failf("Failed getting job %s: %v", jobName, err)
|
||||||
}
|
}
|
||||||
containers := job.Spec.Template.Spec.Containers
|
containers := job.Spec.Template.Spec.Containers
|
||||||
if containers == nil || len(containers) != 1 || containers[0].Image != image {
|
if containers == nil || len(containers) != 1 || containers[0].Image != nginxImage {
|
||||||
Failf("Failed creating job %s for 1 pod with expected image %s", jobName, image)
|
Failf("Failed creating job %s for 1 pod with expected image %s", jobName, nginxImage)
|
||||||
}
|
}
|
||||||
if job.Spec.Template.Spec.RestartPolicy != api.RestartPolicyNever {
|
if job.Spec.Template.Spec.RestartPolicy != api.RestartPolicyNever {
|
||||||
Failf("Failed creating a job with correct restart policy for --restart=OnFailure")
|
Failf("Failed creating a job with correct restart policy for --restart=OnFailure")
|
||||||
|
|
|
@ -963,7 +963,7 @@ var _ = Describe("Pods", func() {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Failf("failed to get pod: %v", err)
|
Failf("failed to get pod: %v", err)
|
||||||
}
|
}
|
||||||
pod.Spec.Containers[0].Image = "nginx"
|
pod.Spec.Containers[0].Image = "gcr.io/google_containers/nginx:1.7.9"
|
||||||
pod, err = podClient.Update(pod)
|
pod, err = podClient.Update(pod)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Failf("error updating pod=%s/%s %v", podName, containerName, err)
|
Failf("error updating pod=%s/%s %v", podName, containerName, err)
|
||||||
|
|
|
@ -7,7 +7,7 @@ metadata:
|
||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: nginx
|
- name: nginx
|
||||||
image: nginx
|
image: gcr.io/google_containers/nginx:1.7.9
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 80
|
- containerPort: 80
|
||||||
readinessProbe:
|
readinessProbe:
|
||||||
|
|
Loading…
Reference in New Issue