From 31397083b2861a2a037f947184cd1f666622b5be Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Sat, 30 Mar 2019 18:45:14 +0100 Subject: [PATCH] test, e2e: add tests for logs -f Signed-off-by: Giuseppe Scrivano --- test/e2e/kubectl/kubectl.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/e2e/kubectl/kubectl.go b/test/e2e/kubectl/kubectl.go index 3f197b2b64b..56ea3c1b278 100644 --- a/test/e2e/kubectl/kubectl.go +++ b/test/e2e/kubectl/kubectl.go @@ -570,6 +570,21 @@ var _ = SIGDescribe("Kubectl client", func() { gomega.Expect(c.BatchV1().Jobs(ns).Delete("run-test-3", nil)).To(gomega.BeNil()) }) + ginkgo.It("should contain last line of the log", func() { + nsFlag := fmt.Sprintf("--namespace=%v", ns) + podName := "run-log-test" + + ginkgo.By("executing a command with run") + framework.RunKubectlOrDie("run", podName, "--generator=run-pod/v1", "--image="+busyboxImage, "--restart=OnFailure", nsFlag, "--", "sh", "-c", "sleep 10; seq 100 | while read i; do echo $i; sleep 0.01; done; echo EOF") + + if !framework.CheckPodsRunningReady(c, ns, []string{podName}, framework.PodStartTimeout) { + framework.Failf("Pod for run-log-test was not ready") + } + + logOutput := framework.RunKubectlOrDie(nsFlag, "logs", "-f", "run-log-test") + gomega.Expect(logOutput).To(gomega.ContainSubstring("EOF")) + }) + ginkgo.It("should support port-forward", func() { ginkgo.By("forwarding the container port to a local port") cmd := runPortForward(ns, simplePodName, simplePodPort)