--- /dev/null
+package de.juplo.kafka.chat.backend;
+
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+import org.springframework.http.MediaType;
+import org.testcontainers.shaded.org.awaitility.Awaitility;
+
+import java.time.Duration;
+
+
+public abstract class AbstractConfigurationWithFixedShardingIT extends AbstractConfigurationIT
+{
+ @Test
+ @DisplayName("A PUT for a not owned shard yields 404 NOT FOUND")
+ void testPutYields404()
+ {
+ Awaitility
+ .await()
+ .atMost(Duration.ofSeconds(15))
+ .untilAsserted(() ->
+ {
+ webTestClient
+ .put()
+ .uri("http://localhost:{port}/97cca12a-af72-11ed-9b9e-f78fa16794ac/otto/66", port)
+ .contentType(MediaType.TEXT_PLAIN)
+ .accept(MediaType.APPLICATION_JSON)
+ .bodyValue("The devil rules route 66")
+ .exchange()
+ .expectStatus().isNotFound();
+ webTestClient
+ .get()
+ .uri("http://localhost:{port}/97cca12a-af72-11ed-9b9e-f78fa16794ac/otto/66", port)
+ .accept(MediaType.APPLICATION_JSON)
+ .exchange()
+ .expectStatus().isNotFound();
+ });
+ }
+}
"chat.backend.inmemory.sharding-strategy=kafkalike",
"chat.backend.inmemory.num-shards=10",
"chat.backend.inmemory.owned-shards=2" })
-class InMemoryWithFilesAndShardingConfigurationIT extends AbstractConfigurationIT
+class InMemoryWithFilesAndShardingConfigurationIT extends AbstractConfigurationWithFixedShardingIT
{
}
properties = {
"chat.backend.inmemory.sharding-strategy=none",
"chat.backend.inmemory.storage-directory=target/test-classes/data/files" })
-class InMemoryWithFilesConfigurationIT extends AbstractConfigurationIT
+class InMemoryWithFilesConfigurationIT extends AbstractConfigurationWithFixedShardingIT
{
}
"chat.backend.inmemory.storage-strategy=mongodb" })
@Testcontainers
@Slf4j
-class InMemoryWithMongoDbConfigurationIT extends AbstractConfigurationIT
+class InMemoryWithMongoDbConfigurationIT extends AbstractConfigurationWithFixedShardingIT
{
private static final int MONGODB_PORT = 27017;