Merge pull request #79699 from k-toyoda-pi/expectequal_e2e_kubectl

Use ExpectEqual in e2e/kubectl
This commit is contained in:
Kubernetes Prow Robot 2019-07-05 16:48:34 -07:00 committed by GitHub
commit 4921e84841
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -388,7 +388,7 @@ var _ = SIGDescribe("Kubectl client", func() {
veryLongData[i] = 'a'
}
execOutput = framework.RunKubectlOrDie("exec", fmt.Sprintf("--namespace=%v", ns), simplePodName, "echo", string(veryLongData))
gomega.Expect(string(veryLongData)).To(gomega.Equal(strings.TrimSpace(execOutput)), "Unexpected kubectl exec output")
framework.ExpectEqual(string(veryLongData), strings.TrimSpace(execOutput), "Unexpected kubectl exec output")
ginkgo.By("executing a command in the container with noninteractive stdin")
execOutput = framework.NewKubectlCommand("exec", fmt.Sprintf("--namespace=%v", ns), "-i", simplePodName, "cat").
@ -493,8 +493,8 @@ var _ = SIGDescribe("Kubectl client", func() {
ginkgo.By("execing into a container with a failing command")
_, err = framework.NewKubectlCommand(nsFlag, "exec", "nginx", "--", "/bin/sh", "-c", "exit 42").Exec()
ee, ok := err.(uexec.ExitError)
gomega.Expect(ok).To(gomega.Equal(true))
gomega.Expect(ee.ExitStatus()).To(gomega.Equal(42))
framework.ExpectEqual(ok, true)
framework.ExpectEqual(ee.ExitStatus(), 42)
ginkgo.By("running a successful command")
_, err = framework.NewKubectlCommand(nsFlag, "run", "-i", "--image="+busyboxImage, "--restart=Never", "success", "--", "/bin/sh", "-c", "exit 0").Exec()
@ -503,8 +503,8 @@ var _ = SIGDescribe("Kubectl client", func() {
ginkgo.By("running a failing command")
_, err = framework.NewKubectlCommand(nsFlag, "run", "-i", "--image="+busyboxImage, "--restart=Never", "failure-1", "--", "/bin/sh", "-c", "exit 42").Exec()
ee, ok = err.(uexec.ExitError)
gomega.Expect(ok).To(gomega.Equal(true))
gomega.Expect(ee.ExitStatus()).To(gomega.Equal(42))
framework.ExpectEqual(ok, true)
framework.ExpectEqual(ee.ExitStatus(), 42)
ginkgo.By("running a failing command without --restart=Never")
_, err = framework.NewKubectlCommand(nsFlag, "run", "-i", "--image="+busyboxImage, "--restart=OnFailure", "failure-2", "--", "/bin/sh", "-c", "cat && exit 42").
@ -1329,17 +1329,17 @@ metadata:
ginkgo.By("limiting log lines")
out := framework.RunKubectlOrDie("log", pod.Name, containerName, nsFlag, "--tail=1")
gomega.Expect(len(out)).NotTo(gomega.BeZero())
gomega.Expect(len(lines(out))).To(gomega.Equal(1))
framework.ExpectEqual(len(lines(out)), 1)
ginkgo.By("limiting log bytes")
out = framework.RunKubectlOrDie("log", pod.Name, containerName, nsFlag, "--limit-bytes=1")
gomega.Expect(len(lines(out))).To(gomega.Equal(1))
gomega.Expect(len(out)).To(gomega.Equal(1))
framework.ExpectEqual(len(lines(out)), 1)
framework.ExpectEqual(len(out), 1)
ginkgo.By("exposing timestamps")
out = framework.RunKubectlOrDie("log", pod.Name, containerName, nsFlag, "--tail=1", "--timestamps")
l := lines(out)
gomega.Expect(len(l)).To(gomega.Equal(1))
framework.ExpectEqual(len(l), 1)
words := strings.Split(l[0], " ")
gomega.Expect(len(words)).To(gomega.BeNumerically(">", 1))
if _, err := time.Parse(time.RFC3339Nano, words[0]); err != nil {