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
This commit is contained in:
Andy Goldstein 2015-04-09 15:42:36 -04:00
parent 2215a64567
commit 00e24603cb
3 changed files with 5 additions and 13 deletions

View File

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

View File

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

View File

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