Merge pull request #90448 from soltysh/issue87851

Fix run command when waiting for pods
This commit is contained in:
Kubernetes Prow Robot
2020-04-24 15:32:17 -07:00
committed by GitHub
5 changed files with 38 additions and 60 deletions

View File

@@ -522,13 +522,21 @@ var _ = SIGDescribe("Kubectl client", func() {
_, err = framework.NewKubectlCommand(ns, nsFlag, "run", "-i", "--image="+busyboxImage, "--restart=OnFailure", "failure-2", "--", "/bin/sh", "-c", "cat && exit 42").
WithStdinData("abcd1234").
Exec()
framework.ExpectNoError(err)
ee, ok = err.(uexec.ExitError)
framework.ExpectEqual(ok, true)
if !strings.Contains(ee.String(), "timed out") {
framework.Failf("Missing expected 'timed out' error, got: %#v", ee)
}
ginkgo.By("running a failing command without --restart=Never, but with --rm")
_, err = framework.NewKubectlCommand(ns, nsFlag, "run", "-i", "--image="+busyboxImage, "--restart=OnFailure", "--rm", "failure-3", "--", "/bin/sh", "-c", "cat && exit 42").
WithStdinData("abcd1234").
Exec()
framework.ExpectNoError(err)
ee, ok = err.(uexec.ExitError)
framework.ExpectEqual(ok, true)
if !strings.Contains(ee.String(), "timed out") {
framework.Failf("Missing expected 'timed out' error, got: %#v", ee)
}
e2epod.WaitForPodToDisappear(f.ClientSet, ns, "failure-3", labels.Everything(), 2*time.Second, wait.ForeverTestTimeout)
ginkgo.By("running a failing command with --leave-stdin-open")