Skip to content

Commit 0543463

Browse files
authored
test: improve reliability of mockwebserver websocket test
Signed-off-by: Marc Nuri <[email protected]>
1 parent 75dc347 commit 0543463

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

junit/mockwebserver/src/test/groovy/io/fabric8/mockwebserver/DefaultMockServerWebSocketTest.groovy

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,12 @@ class DefaultMockServerWebSocketTest extends Specification {
193193
.addSubProtocol("v4.channel.k8s.io"))
194194
and: "A WebSocket listener"
195195
wsReq.onComplete { ws ->
196-
future.complete(ws.result().headers().get("sec-websocket-protocol"))
196+
if (ws.result() != null && ws.result().headers() != null) {
197+
future.complete(ws.result().headers().get("sec-websocket-protocol"))
198+
}
199+
}
200+
if (wsReq.result() != null && wsReq.result().headers() != null) {
201+
future.complete(wsReq.result().headers().get("sec-websocket-protocol"))
197202
}
198203
and: "An instance of AsyncConditions"
199204
def async = new AsyncConditions(1)

0 commit comments

Comments
 (0)