Merge pull request #129586 from soltysh/expand_error_conditions

e2e: expand error conditions when test-ing port-forward
This commit is contained in:
Kubernetes Prow Robot
2025-01-13 03:28:32 -08:00
committed by GitHub

View File

@@ -612,9 +612,12 @@ var _ = SIGDescribe("Kubectl Port forwarding", func() {
ginkgo.By("Check the client error")
gomega.Expect(err).To(gomega.HaveOccurred())
gomega.Expect(err.Error()).To(gomega.Or(
gomega.ContainSubstring("connection reset by peer"),
gomega.ContainSubstring("EOF"),
gomega.ContainSubstring("context deadline exceeded")))
// these two errors indicates remote connection is closed
gomega.ContainSubstring("connection reset by peer"), gomega.ContainSubstring("EOF"),
// this error indicates timeout when POST-ing data
gomega.ContainSubstring("context deadline exceeded"),
// this will happen when trying to write to a closed connection
gomega.ContainSubstring("write: broken pipe")))
ginkgo.By("Check kubectl port-forward exit code")
gomega.Expect(cmd.cmd.ProcessState.ExitCode()).To(gomega.BeNumerically("<", 0), "kubectl port-forward should finish with non-zero exit code")