Commit c4e65df2 authored by Eric Drechsel's avatar Eric Drechsel Committed by Nimi Wariboko Jr

Proxy: Add a failing test which replicates #763

2 websocket connections are made instead of one
parent db4cd8ee
......@@ -102,7 +102,8 @@ func TestReverseProxyInsecureSkipVerify(t *testing.T) {
func TestWebSocketReverseProxyServeHTTPHandler(t *testing.T) {
// No-op websocket backend simply allows the WS connection to be
// accepted then it will be immediately closed. Perfect for testing.
wsNop := httptest.NewServer(websocket.Handler(func(ws *websocket.Conn) {}))
var connCount int
wsNop := httptest.NewServer(websocket.Handler(func(ws *websocket.Conn) { connCount++ }))
defer wsNop.Close()
// Get proxy to use for the test
......@@ -135,6 +136,9 @@ func TestWebSocketReverseProxyServeHTTPHandler(t *testing.T) {
if !bytes.Equal(actual, expected) {
t.Errorf("Expected backend to accept response:\n'%s'\nActually got:\n'%s'", expected, actual)
}
if connCount != 1 {
t.Errorf("Expected 1 websocket connection, got %d", connCount)
}
}
func TestWebSocketReverseProxyFromWSClient(t *testing.T) {
......
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