diff --git a/test/e2e/framework/gobindata_util.go b/test/e2e/framework/gobindata_util.go index aec6f486c13..2353297b326 100644 --- a/test/e2e/framework/gobindata_util.go +++ b/test/e2e/framework/gobindata_util.go @@ -18,18 +18,23 @@ package framework import "k8s.io/kubernetes/test/e2e/generated" -// ReadOrDie reads a file from gobindata. To generate gobindata, run -// -// # Install the program -// go get -u github.com/jteeuwen/go-bindata/... -// -// # Generate the bindata file. -// go-bindata \ -// -pkg generated -ignore .jpg -ignore .png -ignore .md \ -// ./examples/* ./docs/user-guide/* test/e2e/testing-manifests/kubectl/* test/images/* -// -// # Copy it into the generated directory if the results are what you expected. -// cp bindata.go test/e2e/generated +/* +ReadOrDie reads a file from gobindata. To generate gobindata, run + +# Install the program +go get -u github.com/jteeuwen/go-bindata/... + +# Generate the bindata file. +go-bindata \ + -pkg generated -ignore .jpg -ignore .png -ignore .md \ + ./examples/* ./docs/user-guide/* test/e2e/testing-manifests/kubectl/* test/images/* + +# Copy it into the generated directory if the results are what you expected. +cp bindata.go test/e2e/generated + +# Don't forget to gofmt it +gofmt -s -w test/e2e/generated/bindata.go +*/ func ReadOrDie(filePath string) []byte { fileBytes, err := generated.Asset(filePath) if err != nil { diff --git a/test/e2e/kubectl.go b/test/e2e/kubectl.go index 7c85f8202d7..cc28768cf20 100644 --- a/test/e2e/kubectl.go +++ b/test/e2e/kubectl.go @@ -78,6 +78,8 @@ const ( simplePodName = "nginx" nginxDefaultOutput = "Welcome to nginx!" simplePodPort = 80 + pausePodSelector = "name=pause" + pausePodName = "pause" runJobTimeout = 5 * time.Minute busyboxImage = "gcr.io/google_containers/busybox:1.24" nginxImage = "gcr.io/google_containers/nginx:1.7.9" @@ -643,14 +645,14 @@ var _ = framework.KubeDescribe("Kubectl client", func() { var pod []byte var nsFlag string BeforeEach(func() { - pod := framework.ReadOrDie("docs/user-guide/pod.yaml") + pod = readTestFileOrDie("pause-pod.yaml") By("creating the pod") nsFlag = fmt.Sprintf("--namespace=%v", ns) framework.RunKubectlOrDieInput(string(pod), "create", "-f", "-", nsFlag) - Expect(framework.CheckPodsRunningReady(c, ns, []string{simplePodName}, framework.PodStartTimeout)).To(BeTrue()) + Expect(framework.CheckPodsRunningReady(c, ns, []string{pausePodName}, framework.PodStartTimeout)).To(BeTrue()) }) AfterEach(func() { - cleanupKubectlInputs(string(pod[:]), ns, simplePodSelector) + cleanupKubectlInputs(string(pod[:]), ns, pausePodSelector) }) It("should update the label on a resource [Conformance]", func() { @@ -658,19 +660,19 @@ var _ = framework.KubeDescribe("Kubectl client", func() { labelValue := "testing-label-value" By("adding the label " + labelName + " with value " + labelValue + " to a pod") - framework.RunKubectlOrDie("label", "pods", simplePodName, labelName+"="+labelValue, nsFlag) + framework.RunKubectlOrDie("label", "pods", pausePodName, labelName+"="+labelValue, nsFlag) By("verifying the pod has the label " + labelName + " with the value " + labelValue) - output := framework.RunKubectlOrDie("get", "pod", simplePodName, "-L", labelName, nsFlag) + output := framework.RunKubectlOrDie("get", "pod", pausePodName, "-L", labelName, nsFlag) if !strings.Contains(output, labelValue) { - framework.Failf("Failed updating label " + labelName + " to the pod " + simplePodName) + framework.Failf("Failed updating label " + labelName + " to the pod " + pausePodName) } By("removing the label " + labelName + " of a pod") - framework.RunKubectlOrDie("label", "pods", simplePodName, labelName+"-", nsFlag) + framework.RunKubectlOrDie("label", "pods", pausePodName, labelName+"-", nsFlag) By("verifying the pod doesn't have the label " + labelName) - output = framework.RunKubectlOrDie("get", "pod", simplePodName, "-L", labelName, nsFlag) + output = framework.RunKubectlOrDie("get", "pod", pausePodName, "-L", labelName, nsFlag) if strings.Contains(output, labelValue) { - framework.Failf("Failed removing label " + labelName + " of the pod " + simplePodName) + framework.Failf("Failed removing label " + labelName + " of the pod " + pausePodName) } }) })