From 0e5178b7a3b8c8f3167f99c2d36452a2a68c80fa Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Thu, 14 Mar 2024 12:05:11 +0100 Subject: [PATCH] WIP:test: `*ConfigurationIT` asserts, if restored messages can be seen --- .../chat/backend/AbstractConfigurationIT.java | 33 ++----------------- ...thNoStorageAndShardingConfigurationIT.java | 6 +--- .../InMemoryWithNoStorageConfigurationIT.java | 6 +--- 3 files changed, 4 insertions(+), 41 deletions(-) diff --git a/src/test/java/de/juplo/kafka/chat/backend/AbstractConfigurationIT.java b/src/test/java/de/juplo/kafka/chat/backend/AbstractConfigurationIT.java index 3e0efd34..9d870889 100644 --- a/src/test/java/de/juplo/kafka/chat/backend/AbstractConfigurationIT.java +++ b/src/test/java/de/juplo/kafka/chat/backend/AbstractConfigurationIT.java @@ -251,37 +251,8 @@ public abstract class AbstractConfigurationIT } @Test - @DisplayName("Restored messages can be seen, when listening to restored chat-room") - void testListenToRestoredChatRoomYieldsRestoredMessages() - { - Awaitility - .await() - .atMost(Duration.ofSeconds(15)) - .untilAsserted(() -> - { - Flux result = webTestClient - .get() - .uri( - "http://localhost:{port}/{chatRoomId}/listen", - port, - EXISTING_CHATROOM) - .accept(MediaType.TEXT_EVENT_STREAM) - .exchange() - .expectStatus().isOk() - .returnResult(MessageTo.class) - .getResponseBody(); - - List messages = result - .take(expectedExistingMessages.length) - .collectList() - .block(); - assertThat(messages).containsExactly(expectedExistingMessages); - }); - } - - @Test - @DisplayName("Newly send messages can be seen, when listening to restored chat-room") - void testListenToRestoredChatRoomYieldsAddedMessages() + @DisplayName("Only newly send messages can be seen, when listening to restored chat-room") + void testListenToRestoredChatRoomYieldsOnlyNewlyAddedMessages() { MessageTo sentMessage = webTestClient .put() diff --git a/src/test/java/de/juplo/kafka/chat/backend/InMemoryWithNoStorageAndShardingConfigurationIT.java b/src/test/java/de/juplo/kafka/chat/backend/InMemoryWithNoStorageAndShardingConfigurationIT.java index 830a822c..5696d7ef 100644 --- a/src/test/java/de/juplo/kafka/chat/backend/InMemoryWithNoStorageAndShardingConfigurationIT.java +++ b/src/test/java/de/juplo/kafka/chat/backend/InMemoryWithNoStorageAndShardingConfigurationIT.java @@ -31,9 +31,5 @@ class InMemoryWithNoStorageAndShardingConfigurationIT extends AbstractConfigurat @Override @Disabled("Chat-Rooms cannot be restored, if storage is disabled") - void testListenToRestoredChatRoomYieldsRestoredMessages() {} - - @Override - @Disabled("Chat-Rooms cannot be restored, if storage is disabled") - void testListenToRestoredChatRoomYieldsAddedMessages() {} + void testListenToRestoredChatRoomYieldsOnlyNewlyAddedMessages() {} } diff --git a/src/test/java/de/juplo/kafka/chat/backend/InMemoryWithNoStorageConfigurationIT.java b/src/test/java/de/juplo/kafka/chat/backend/InMemoryWithNoStorageConfigurationIT.java index b23da119..90c0b8d6 100644 --- a/src/test/java/de/juplo/kafka/chat/backend/InMemoryWithNoStorageConfigurationIT.java +++ b/src/test/java/de/juplo/kafka/chat/backend/InMemoryWithNoStorageConfigurationIT.java @@ -29,9 +29,5 @@ class InMemoryWithNoStorageConfigurationIT extends AbstractConfigurationIT @Override @Disabled("Chat-Rooms cannot be restored, if storage is disabled") - void testListenToRestoredChatRoomYieldsRestoredMessages() {} - - @Override - @Disabled("Chat-Rooms cannot be restored, if storage is disabled") - void testListenToRestoredChatRoomYieldsAddedMessages() {} + void testListenToRestoredChatRoomYieldsOnlyNewlyAddedMessages() {} } -- 2.20.1