From 6548c962202c78b4d4b68314d99a0e2501441577 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?TATSUNO=20=E2=80=9CTaz=E2=80=9D=20Yasuhiro?= Date: Sat, 17 Oct 2026 02:30:10 +0900 Subject: [PATCH] chore(test): send the ElastiCache @AfterAll cleanup to the test port (#5813) Quarkus resets RestAssured to the default port after each test, so the static cleanup of these classes went to port 8080 and failed silently. Their replication groups, clusters and users stayed until the application stopped. --- .../elasticache/ElastiCacheClusterIntegrationTest.java | 6 ++++++ .../services/elasticache/ElastiCacheIntegrationTest.java | 7 +++++++ .../elasticache/ElastiCacheMemcachedIntegrationTest.java | 6 ++++++ .../elasticache/ElastiCachePortSharingIntegrationTest.java | 6 ++++++ .../ElastiCacheRedisClusterIntegrationTest.java | 6 ++++++ 5 files changed, 31 insertions(+) diff --git a/src/test/java/io/github/hectorvent/floci/services/elasticache/ElastiCacheClusterIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/elasticache/ElastiCacheClusterIntegrationTest.java index 0a87041c47..bd3d7170b4 100644 --- a/src/test/java/io/github/hectorvent/floci/services/elasticache/ElastiCacheClusterIntegrationTest.java +++ b/src/test/java/io/github/hectorvent/floci/services/elasticache/ElastiCacheClusterIntegrationTest.java @@ -1,6 +1,7 @@ package io.github.hectorvent.floci.services.elasticache; import io.github.hectorvent.floci.testing.DockerAvailability; +import io.quarkus.test.common.http.TestHTTPResource; import io.quarkus.test.junit.QuarkusTest; import io.restassured.path.xml.XmlPath; import org.junit.jupiter.api.AfterAll; @@ -15,6 +16,7 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.Socket; +import java.net.URI; import java.nio.charset.StandardCharsets; import java.util.List; @@ -42,6 +44,9 @@ class ElastiCacheClusterIntegrationTest { private static final int SOCKET_TIMEOUT_MS = 10_000; private static int configurationEndpointPort; + + @TestHTTPResource("/") + static URI baseUri; private static int secondShardPort; @BeforeAll @@ -53,6 +58,7 @@ class ElastiCacheClusterIntegrationTest { static void cleanup() { try { given() + .port(baseUri.getPort()) .formParam("Action", "DeleteReplicationGroup") .formParam("ReplicationGroupId", GROUP_ID) .header("Authorization", AUTH_HEADER) diff --git a/src/test/java/io/github/hectorvent/floci/services/elasticache/ElastiCacheIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/elasticache/ElastiCacheIntegrationTest.java index 529ea994a7..52b3cecd74 100644 --- a/src/test/java/io/github/hectorvent/floci/services/elasticache/ElastiCacheIntegrationTest.java +++ b/src/test/java/io/github/hectorvent/floci/services/elasticache/ElastiCacheIntegrationTest.java @@ -1,5 +1,6 @@ package io.github.hectorvent.floci.services.elasticache; +import io.quarkus.test.common.http.TestHTTPResource; import io.quarkus.test.junit.QuarkusTest; import org.jboss.logging.Logger; import org.junit.jupiter.api.AfterAll; @@ -15,6 +16,7 @@ import java.io.InputStream; import java.io.OutputStream; import java.net.Socket; import java.net.SocketTimeoutException; +import java.net.URI; import java.nio.charset.StandardCharsets; import java.util.List; @@ -49,6 +51,9 @@ class ElastiCacheIntegrationTest { private static final int READ_LINE_MAX_ATTEMPTS = 3; private static int firstProxyPort; + + @TestHTTPResource("/") + static URI baseUri; private static int crossGroupPort; @BeforeAll @@ -63,6 +68,7 @@ class ElastiCacheIntegrationTest { for (String groupId : List.of(CROSS_GROUP_ID, GROUP_ID, GROUP_ID + "-reused")) { try { given() + .port(baseUri.getPort()) .formParam("Action", "DeleteReplicationGroup") .formParam("ReplicationGroupId", groupId) .header("Authorization", AUTH_HEADER) @@ -71,6 +77,7 @@ class ElastiCacheIntegrationTest { } try { given() + .port(baseUri.getPort()) .formParam("Action", "DeleteUser") .formParam("UserId", USER_ID) .header("Authorization", AUTH_HEADER) diff --git a/src/test/java/io/github/hectorvent/floci/services/elasticache/ElastiCacheMemcachedIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/elasticache/ElastiCacheMemcachedIntegrationTest.java index 8ead5280da..d14864df75 100644 --- a/src/test/java/io/github/hectorvent/floci/services/elasticache/ElastiCacheMemcachedIntegrationTest.java +++ b/src/test/java/io/github/hectorvent/floci/services/elasticache/ElastiCacheMemcachedIntegrationTest.java @@ -1,5 +1,6 @@ package io.github.hectorvent.floci.services.elasticache; +import io.quarkus.test.common.http.TestHTTPResource; import io.quarkus.test.junit.QuarkusTest; import io.restassured.path.xml.XmlPath; import org.junit.jupiter.api.AfterAll; @@ -14,6 +15,7 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.Socket; +import java.net.URI; import java.nio.charset.StandardCharsets; import static io.restassured.RestAssured.given; @@ -32,6 +34,9 @@ class ElastiCacheMemcachedIntegrationTest { private static final int SOCKET_TIMEOUT_MS = 10_000; private static String clusterHost; + + @TestHTTPResource("/") + static URI baseUri; private static int clusterPort; @BeforeAll @@ -43,6 +48,7 @@ class ElastiCacheMemcachedIntegrationTest { static void cleanup() { try { given() + .port(baseUri.getPort()) .formParam("Action", "DeleteCacheCluster") .formParam("CacheClusterId", CLUSTER_ID) .header("Authorization", AUTH_HEADER) diff --git a/src/test/java/io/github/hectorvent/floci/services/elasticache/ElastiCachePortSharingIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/elasticache/ElastiCachePortSharingIntegrationTest.java index 18eb585bd9..6912722e7c 100644 --- a/src/test/java/io/github/hectorvent/floci/services/elasticache/ElastiCachePortSharingIntegrationTest.java +++ b/src/test/java/io/github/hectorvent/floci/services/elasticache/ElastiCachePortSharingIntegrationTest.java @@ -1,6 +1,7 @@ package io.github.hectorvent.floci.services.elasticache; import io.github.hectorvent.floci.services.elasticache.container.ElastiCacheContainerManager; +import io.quarkus.test.common.http.TestHTTPResource; import io.quarkus.test.junit.QuarkusTest; import io.restassured.response.ValidatableResponse; import jakarta.inject.Inject; @@ -15,6 +16,7 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.Socket; +import java.net.URI; import java.nio.charset.StandardCharsets; import java.util.List; @@ -85,6 +87,9 @@ class ElastiCachePortSharingIntegrationTest { + ".CacheNodes.CacheNode.Endpoint.Port"; private static int firstPort; + + @TestHTTPResource("/") + static URI baseUri; private static int secondPort; /** The manager that starts these caches' containers, so the guard is the service's own. */ @@ -96,6 +101,7 @@ class ElastiCachePortSharingIntegrationTest { for (String groupId : List.of(FIRST_GROUP, SECOND_GROUP)) { try { given() + .port(baseUri.getPort()) .formParam("Action", "DeleteReplicationGroup") .formParam("ReplicationGroupId", groupId) .header("Authorization", AUTH_HEADER) diff --git a/src/test/java/io/github/hectorvent/floci/services/elasticache/ElastiCacheRedisClusterIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/elasticache/ElastiCacheRedisClusterIntegrationTest.java index 480c755db0..0577897ed1 100644 --- a/src/test/java/io/github/hectorvent/floci/services/elasticache/ElastiCacheRedisClusterIntegrationTest.java +++ b/src/test/java/io/github/hectorvent/floci/services/elasticache/ElastiCacheRedisClusterIntegrationTest.java @@ -1,6 +1,7 @@ package io.github.hectorvent.floci.services.elasticache; import io.github.hectorvent.floci.testing.DockerAvailability; +import io.quarkus.test.common.http.TestHTTPResource; import io.quarkus.test.junit.QuarkusTest; import io.restassured.path.xml.XmlPath; import org.junit.jupiter.api.AfterAll; @@ -15,6 +16,7 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.Socket; +import java.net.URI; import java.nio.charset.StandardCharsets; import static io.restassured.RestAssured.given; @@ -38,6 +40,9 @@ class ElastiCacheRedisClusterIntegrationTest { private static final int SOCKET_TIMEOUT_MS = 10_000; private static String nodeHost; + + @TestHTTPResource("/") + static URI baseUri; private static int nodePort; @BeforeAll @@ -49,6 +54,7 @@ class ElastiCacheRedisClusterIntegrationTest { static void cleanup() { try { given() + .port(baseUri.getPort()) .formParam("Action", "DeleteCacheCluster") .formParam("CacheClusterId", CLUSTER_ID) .header("Authorization", AUTH_HEADER)