From 99b135442c69a00cad9847b442ec624edc364b32 Mon Sep 17 00:00:00 2001 From: Kenichi Omichi Date: Fri, 10 Jan 2020 02:43:53 +0000 Subject: [PATCH] Add error handling of CloseWrite() The e2e test "Kubectl Port forwarding With a server listening .." is failed sometimes due to the difference between expected data and received data. To receive the data, the test does CloseWrite() but it didn't have the corresponding error handling. This adds it to investigate the issue more. --- test/e2e/kubectl/portforward.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/e2e/kubectl/portforward.go b/test/e2e/kubectl/portforward.go index 2b00ff8ec62..2834f39c229 100644 --- a/test/e2e/kubectl/portforward.go +++ b/test/e2e/kubectl/portforward.go @@ -321,7 +321,9 @@ func doTestMustConnectSendDisconnect(bindAddress string, f *framework.Framework) fmt.Fprint(conn, "abc") ginkgo.By("Closing the write half of the client's connection") - conn.CloseWrite() + if err = conn.CloseWrite(); err != nil { + framework.Failf("Couldn't close the write half of the client's connection: %v", err) + } ginkgo.By("Reading data from the local port") fromServer, err := ioutil.ReadAll(conn)