Fix test failure only seen on CI

The failure was in GraphQlWebSocketHandlerTests for WebMvc.
the subscriptionExists test checks that a second subscription with
same id will close the connection with 4409. It also checks that
2 messages have arrived (connection_init) and one message from the
first subscription. However, since message handling as async,
handling of the two subscriptions is concurrent, and the connection
may be closed before the first subscription is able to send.

This commit adjusts the message checks to be more lenient and
accept between 1 and 2 messages.
This commit is contained in:
rstoyanchev
2024-05-20 12:23:36 +01:00
parent aa1ee77867
commit 91b6beb2b2
2 changed files with 4 additions and 5 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -288,8 +288,8 @@ public class GraphQlWebSocketHandlerTests extends WebSocketHandlerTestSupport {
.verify(TIMEOUT);
assertThat(messages.size()).isEqualTo(2);
assertThat(messages.size()).isGreaterThanOrEqualTo(1).isLessThan(3);
assertThat(messages.get(0).resolvedType()).isEqualTo(GraphQlWebSocketMessageType.CONNECTION_ACK);
assertThat(messages.get(1).resolvedType()).isEqualTo(GraphQlWebSocketMessageType.NEXT);
}
@Test

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -293,9 +293,8 @@ public class GraphQlWebSocketHandlerTests extends WebSocketHandlerTestSupport {
.expectComplete()
.verify(TIMEOUT);
assertThat(messages.size()).isEqualTo(2);
assertThat(messages.size()).isGreaterThanOrEqualTo(1).isLessThan(3);
assertThat(messages.get(0).resolvedType()).isEqualTo(GraphQlWebSocketMessageType.CONNECTION_ACK);
assertThat(messages.get(1).resolvedType()).isEqualTo(GraphQlWebSocketMessageType.NEXT);
}
@Test