graphql-spring-boot icon indicating copy to clipboard operation
graphql-spring-boot copied to clipboard

GraphQLTestSubscription fails to init() when using @GraphQLTest

Open lassemaatta opened this issue 3 years ago • 2 comments

Describe the bug

GraphQLTestSubscription fails to create a WebSocket connection in a test.

To Reproduce Steps to reproduce the behavior:

  1. Define a test class annotated with @GraphQLTest
  2. Autowire the GraphQLTestSubscription dependency
  3. call init() on the test subcription
  4. See error:
Caused by: javax.websocket.DeploymentException: The HTTP response from the server [404] did not permit the HTTP upgrade to WebSocket
	at org.apache.tomcat.websocket.WsWebSocketContainer.connectToServerRecursive(WsWebSocketContainer.java:440)
	at org.apache.tomcat.websocket.WsWebSocketContainer.connectToServer(WsWebSocketContainer.java:197)
	at com.graphql.spring.boot.test.GraphQLTestSubscription.initClient(GraphQLTestSubscription.java:387)

Expected behavior GraphQLTestSubscription should establish the WebSocket connection without errors.

Additional context I did notice that @GraphQLTest does not seem to include GraphQLWebsocketAutoConfiguration. However, importing it to the test context did not seem to fix the issue.

lassemaatta avatar Mar 15 '21 10:03 lassemaatta