From 6ff9ff73c9ba303feb953e82d1b4a288266da748 Mon Sep 17 00:00:00 2001 From: tkuzynow Date: Thu, 17 Nov 2022 10:02:16 +0100 Subject: [PATCH] fix: change timeout for tests --- .../de/caritas/cob/liveservice/LiveServiceApplicationIT.java | 5 +++-- .../caritas/cob/liveservice/StompClientIntegrationTest.java | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/test/java/de/caritas/cob/liveservice/LiveServiceApplicationIT.java b/src/test/java/de/caritas/cob/liveservice/LiveServiceApplicationIT.java index c718968..1c0c62c 100644 --- a/src/test/java/de/caritas/cob/liveservice/LiveServiceApplicationIT.java +++ b/src/test/java/de/caritas/cob/liveservice/LiveServiceApplicationIT.java @@ -98,10 +98,11 @@ void subscribe_Should_subscribeUser() throws Exception { var stompSession = performConnect(FIRST_VALID_USER); final Subscription subscription = performSubscribe(stompSession); + assertThat(this.socketUserRegistry.retrieveAllUsers(), hasSize(1)); WebSocketUserSession registeredUser = this.socketUserRegistry.retrieveAllUsers().get(0); await() - .atMost(MESSAGE_TIMEOUT, SECONDS) + .atMost(15, SECONDS) .until(registeredUser::getSubscriptionId, notNullValue()); assertThat(registeredUser, notNullValue()); @@ -110,11 +111,11 @@ void subscribe_Should_subscribeUser() throws Exception { assertThat(registeredUser.getSubscriptionId(), notNullValue()); assertThat(subscription.getSubscriptionHeaders().get("destination"), contains(SUBSCRIPTION_ENDPOINT)); - performDisconnect(stompSession); } @Test void disconnect_Should_removeUserFromRegistry() throws Exception { + var stompSession = performConnect(FIRST_VALID_USER); assertThat(this.socketUserRegistry.retrieveAllUsers(), hasSize(1)); diff --git a/src/test/java/de/caritas/cob/liveservice/StompClientIntegrationTest.java b/src/test/java/de/caritas/cob/liveservice/StompClientIntegrationTest.java index 816b01c..58acad1 100644 --- a/src/test/java/de/caritas/cob/liveservice/StompClientIntegrationTest.java +++ b/src/test/java/de/caritas/cob/liveservice/StompClientIntegrationTest.java @@ -48,7 +48,7 @@ public abstract class StompClientIntegrationTest extends AbstractJUnit4SpringContextTests { protected static final String SUBSCRIPTION_ENDPOINT = "/user/events"; - protected static final int MESSAGE_TIMEOUT = 2; + protected static final int MESSAGE_TIMEOUT = 5; protected static final String FIRST_VALID_USER = "firstValidUser"; static final String SECOND_VALID_USER = "secondValidUser"; static final String THIRD_VALID_USER = "thirdValidUser";