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.
This commit is contained in:
Kenichi Omichi 2020-01-10 02:43:53 +00:00
parent aef336d712
commit 99b135442c

View File

@ -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)