Skip to content

Commit d328755

Browse files
authored
Merge pull request kubernetes#91227 from aojea/kcliwait
kubectl run test: the pod wait (some time) until attach before printing
2 parents f7a6e9e + a0f0e58 commit d328755

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

test/e2e/kubectl/kubectl.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,12 @@ var _ = SIGDescribe("Kubectl client", func() {
561561
gomega.Expect(c.CoreV1().Pods(ns).Delete(context.TODO(), "run-test", metav1.DeleteOptions{})).To(gomega.BeNil())
562562

563563
ginkgo.By("executing a command with run and attach without stdin")
564-
runOutput = framework.NewKubectlCommand(ns, fmt.Sprintf("--namespace=%v", ns), "run", "run-test-2", "--image="+busyboxImage, "--restart=OnFailure", "--attach=true", "--leave-stdin-open=true", "--", "sh", "-c", "cat && echo 'stdin closed'").
564+
// There is a race on this scenario described in #73099
565+
// It fails if we are not able to attach before the container prints
566+
// "stdin closed", but hasn't exited yet.
567+
// We wait 5 seconds before printing to give time to kubectl to attach
568+
// to the container, this does not solve the race though.
569+
runOutput = framework.NewKubectlCommand(ns, fmt.Sprintf("--namespace=%v", ns), "run", "run-test-2", "--image="+busyboxImage, "--restart=OnFailure", "--attach=true", "--leave-stdin-open=true", "--", "sh", "-c", "sleep 5; cat && echo 'stdin closed'").
565570
WithStdinData("abcd1234").
566571
ExecOrDie(ns)
567572
gomega.Expect(runOutput).ToNot(gomega.ContainSubstring("abcd1234"))

0 commit comments

Comments
 (0)