Code change:
defer ws.Close() buf := &bytes.Buffer{} <del> for { var msg []byte if err := websocket.Message.Receive(ws, &msg); err != nil { if err == io.EOF { break </del> <ins> Eventually(func() error { for { var msg []byte if err := websocket.Message.Receive(ws, &msg); err != nil { if err == io.EOF { break } framework.Failf("Failed to read completely from websocket %s: %v", url.String(), err) </ins> } <del> framework.Failf("Failed to read completely from websocket %s: %v", url.String(), err) </del> <ins> if len(msg) == 0 { continue } if msg[0] != 1 { framework.Failf("Got message from server that didn't start with channel 1 (STDOUT): %v", msg) } buf.Write(msg[1:]) </ins> } <del> if len(msg) == 0 { continue </del> <ins> if buf.Len() == 0 { return fmt.Errorf("Unexpected output from server") </ins> } <del> if msg[0] != 1 { framework.Failf("Got message from server that didn't start with channel 1 (STDOUT): %v", msg) </del> <ins> if !strings.Contains(buf.String(), "nameserver") { return fmt.Errorf("Expected to find 'nameserver' in %q", buf.String()) </ins> } <del> buf.Write(msg[1:]) } if buf.Len() == 0 { framework.Failf("Unexpected output from server") } if !strings.Contains(buf.String(), "nameserver") { framework.Failf("Expected to find 'nameserver' in %q", buf.String()) } </del> <ins> return nil }, time.Minute, 10*time.Second).Should(BeNil()) </ins> }) It("should support retrieving logs from the container over websockets", func() {

Related discussion:
text: https://k8s- Failed: [] Pods should support retrieving logs from the container over websockets {E2eNode Suite}
https://k8s- Failed: [] Pods should support retrieving logs from the container over websockets {E2eNode Suite} Happened on a presubmit run in .
https://k8s- Failed: [] Pods should support retrieving logs from the container over websockets {E2eNode Suite} Happened on a presubmit run in .
https://k8s- Failed: [] Pods should support retrieving logs from the container over websockets {E2eNode Suite} Happened on a presubmit run in .
https://k8s- Failed: [] Pods should support retrieving logs from the container over websockets {E2eNode Suite} Happened on a presubmit run in .
https://k8s- Failed: [] Pods should support retrieving logs from the container over websockets {E2eNode Suite} Happened on a presubmit run in .
https://k8s- Failed: [] Pods should support retrieving logs from the container over websockets {E2eNode Suite} Happened on a presubmit run in .
https://k8s- Failed: [] Pods should support retrieving logs from the container over websockets {E2eNode Suite} Happened on a presubmit run in .
https://k8s- Failed: [] Pods should support retrieving logs from the container over websockets {E2eNode Suite} Happened on a presubmit run in .
https://k8s- Failed: [] Pods should support retrieving logs from the container over websockets {E2eNode Suite} Happened on a presubmit run in .
https://k8s- Failed: [] Pods should support retrieving logs from the container over websockets {E2eNode Suite}
The test pod gets deleted by the test upon failure and so there is not enough information about the state of the test pod. I'm changing the test to not delete the pod and instead let the namespace deletion logic in the test framework handle deletions. I'm also increasing the pod lifetime from to a longer duration to avoid any possible race conditions in the test. The test will also retry if the logs output from the test pod does not contain non-space characters.