mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
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.
This commit is contained in:
1 parent
772ec8d0c9
commit
6548c96220
5 files changed
+31
No files matched your search
+6
@@ -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)
|
||||
|
||||
+7
@@ -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)
|
||||
|
||||
+6
@@ -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)
|
||||
|
||||
+6
@@ -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)
|
||||
|
||||
+6
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user