Commit 00e24603 authored by Andy Goldstein's avatar Andy Goldstein

Fix TestServeExecInContainerIdleTimeout flake

Remove creation of stream from TestServeExecInContainerIdleTimeout as it's not necessary to very idle timeout. Increase stream creation and ack timeouts to 30 seconds. Fixes #5628
parent 2215a645
......@@ -436,6 +436,8 @@ func (s *Server) handleRun(w http.ResponseWriter, req *http.Request) {
w.Write(data)
}
const streamCreationTimeout = 30 * time.Second
// handleExec handles requests to run a command inside a container.
func (s *Server) handleExec(w http.ResponseWriter, req *http.Request) {
u, err := url.ParseRequestURI(req.RequestURI)
......@@ -491,9 +493,8 @@ func (s *Server) handleExec(w http.ResponseWriter, req *http.Request) {
conn.SetIdleTimeout(s.host.StreamingConnectionIdleTimeout())
// TODO find a good default timeout value
// TODO make it configurable?
expired := time.NewTimer(2 * time.Second)
expired := time.NewTimer(streamCreationTimeout)
var errorStream, stdinStream, stdoutStream, stderrStream httpstream.Stream
receivedStreams := 0
......@@ -641,7 +642,7 @@ func waitForPortForwardDataStreamAndRun(pod string, uid types.UID, errorStream h
select {
case dataStream = <-dataStreamChan:
case <-time.After(1 * time.Second):
case <-time.After(streamCreationTimeout):
errorStream.Write([]byte("Timed out waiting for data stream"))
//TODO delete from dataStreamChans[port]
return
......
......@@ -655,15 +655,6 @@ func TestServeExecInContainerIdleTimeout(t *testing.T) {
if conn == nil {
t.Fatal("Unexpected nil connection")
}
defer conn.Close()
h := http.Header{}
h.Set(api.StreamType, api.StreamTypeError)
stream, err := conn.CreateStream(h)
if err != nil {
t.Fatalf("error creating input stream: %v", err)
}
defer stream.Reset()
<-conn.CloseChan()
}
......
......@@ -71,7 +71,7 @@ func newConnection(conn *spdystream.Connection, newStreamHandler httpstream.NewS
// createStreamResponseTimeout indicates how long to wait for the other side to
// acknowledge the new stream before timing out.
const createStreamResponseTimeout = 2 * time.Second
const createStreamResponseTimeout = 30 * time.Second
// Close first sends a reset for all of the connection's streams, and then
// closes the underlying spdystream.Connection.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment