// TestStreamTranslator_LoopbackStdinToStdout returns random data sent on the client's // STDIN channel back onto the client's STDOUT channel. There are two servers in this test: the // upstream fake SPDY server, and the StreamTranslator server. The StreamTranslator proxys the // data received from the websocket client upstream to the SPDY server (by translating the // websocket data into spdy). The returned data read on the websocket client STDOUT is then // compared the random data sent on STDIN to ensure they are the same. func TestStreamTranslator_LoopbackStdinToStdout(t *testing.T) { … } // TestStreamTranslator_LoopbackStdinToStderr returns random data sent on the client's // STDIN channel back onto the client's STDERR channel. There are two servers in this test: the // upstream fake SPDY server, and the StreamTranslator server. The StreamTranslator proxys the // data received from the websocket client upstream to the SPDY server (by translating the // websocket data into spdy). The returned data read on the websocket client STDERR is then // compared the random data sent on STDIN to ensure they are the same. func TestStreamTranslator_LoopbackStdinToStderr(t *testing.T) { … } // Returns a random exit code in the range(1-127). func randomExitCode() int { … } // TestStreamTranslator_ErrorStream tests the error stream by sending an error with a random // exit code, then validating the error arrives on the error stream. func TestStreamTranslator_ErrorStream(t *testing.T) { … } // TestStreamTranslator_MultipleReadChannels tests two streams (STDOUT, STDERR) reading from // the connections at the same time. func TestStreamTranslator_MultipleReadChannels(t *testing.T) { … } // TestStreamTranslator_ThrottleReadChannels tests two streams (STDOUT, STDERR) using rate limited streams. func TestStreamTranslator_ThrottleReadChannels(t *testing.T) { … } type fakeTerminalSizeQueue … // newTerminalSizeQueue returns a pointer to a fakeTerminalSizeQueue passing // "max" number of random TerminalSizes created. func newTerminalSizeQueue(max int) *fakeTerminalSizeQueue { … } // Next returns a pointer to the next random TerminalSize, or nil if we have // already returned "maxSizes" TerminalSizes already. Stores the randomly // created TerminalSize in "terminalSizes" field for later validation. func (f *fakeTerminalSizeQueue) Next() *remotecommand.TerminalSize { … } // randomTerminalSize returns a TerminalSize with random values in the // range (0-65535) for the fields Width and Height. func randomTerminalSize() remotecommand.TerminalSize { … } // TestStreamTranslator_MultipleWriteChannels func TestStreamTranslator_TTYResizeChannel(t *testing.T) { … } // TestStreamTranslator_WebSocketServerErrors validates that when there is a problem creating // the websocket server as the first step of the StreamTranslator an error is properly returned. func TestStreamTranslator_WebSocketServerErrors(t *testing.T) { … } // TestStreamTranslator_BlockRedirects verifies that the StreamTranslator will *not* follow // redirects; it will thrown an error instead. func TestStreamTranslator_BlockRedirects(t *testing.T) { … } type streamContext … type streamAndReply … // CreateSPDYServerStreams upgrades the passed HTTP request to a SPDY bi-directional streaming // connection with remote command streams defined in passed options. Returns a streamContext // structure containing the Reader/Writer streams to communicate through the SDPY connection. // Returns an error if unable to upgrade the HTTP connection to a SPDY connection. func createSPDYServerStreams(w http.ResponseWriter, req *http.Request, opts Options) (*streamContext, error) { … } func v4WriteStatusFunc(stream io.Writer) func(status *apierrors.StatusError) error { … } func fakeTransport() (*http.Transport, error) { … }