From c4d33a6bd853b3fbd628c10c81db3d873f0de9d6 Mon Sep 17 00:00:00 2001 From: David Phillips Date: Mon, 12 Oct 2026 05:09:52 -0700 Subject: [PATCH] test(rds): share requests across existing integration suites (#5496) --- ...rEngineModeStorageEncryptedIntegrationTest.java | 12 +----------- ...sClusterSnapshotRestorePortIntegrationTest.java | 13 +------------ .../RdsIamAuthLambdaSessionIntegrationTest.java | 14 +------------- ...RdsInstanceMonitoringFieldsIntegrationTest.java | 12 +----------- .../rds/RdsInstanceScalingIntegrationTest.java | 12 +----------- 5 files changed, 5 insertions(+), 58 deletions(-) diff --git a/src/test/java/io/github/hectorvent/floci/services/rds/RdsClusterEngineModeStorageEncryptedIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/rds/RdsClusterEngineModeStorageEncryptedIntegrationTest.java index ea509a1f4b..9afa57ae11 100644 --- a/src/test/java/io/github/hectorvent/floci/services/rds/RdsClusterEngineModeStorageEncryptedIntegrationTest.java +++ b/src/test/java/io/github/hectorvent/floci/services/rds/RdsClusterEngineModeStorageEncryptedIntegrationTest.java @@ -6,8 +6,7 @@ import io.quarkus.test.junit.TestProfile; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Test; -import static io.restassured.RestAssured.given; -import static io.restassured.http.ContentType.URLENC; +import static io.github.hectorvent.floci.testing.RdsRequests.rds; import static org.hamcrest.Matchers.containsString; /** @@ -24,15 +23,6 @@ class RdsClusterEngineModeStorageEncryptedIntegrationTest { private static final String ID = "engine-mode-cluster"; private static final String NON_AURORA_ID = "engine-mode-non-aurora-cluster"; - private static io.restassured.specification.RequestSpecification rds(String action) { - return given().header("Authorization", - "AWS4-HMAC-SHA256 Credential=test/20260615/us-east-1/rds/aws4_request, " - + "SignedHeaders=content-type;host, Signature=test") - .contentType(URLENC) - .formParam("Action", action) - .formParam("Version", "2014-10-31"); - } - @AfterEach void cleanUp() { rds("DeleteDBCluster").formParam("DBClusterIdentifier", ID) diff --git a/src/test/java/io/github/hectorvent/floci/services/rds/RdsClusterSnapshotRestorePortIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/rds/RdsClusterSnapshotRestorePortIntegrationTest.java index 0c21ecd87e..a8de6820c0 100644 --- a/src/test/java/io/github/hectorvent/floci/services/rds/RdsClusterSnapshotRestorePortIntegrationTest.java +++ b/src/test/java/io/github/hectorvent/floci/services/rds/RdsClusterSnapshotRestorePortIntegrationTest.java @@ -3,12 +3,10 @@ package io.github.hectorvent.floci.services.rds; import io.github.hectorvent.floci.testing.RdsMockProfile; import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.junit.TestProfile; -import io.restassured.specification.RequestSpecification; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Test; -import static io.restassured.RestAssured.given; -import static io.restassured.http.ContentType.URLENC; +import static io.github.hectorvent.floci.testing.RdsRequests.rds; import static org.hamcrest.Matchers.containsString; /** RDS creation and restore responses must expose usable proxy ports on the wire. */ @@ -24,15 +22,6 @@ class RdsClusterSnapshotRestorePortIntegrationTest { private static final String INSTANCE_SNAPSHOT = "restore-port-instance-snapshot"; private static final String RESTORED_INSTANCE = "restore-port-instance-target"; - private static RequestSpecification rds(String action) { - return given().header("Authorization", - "AWS4-HMAC-SHA256 Credential=test/20260924/us-east-1/rds/aws4_request, " - + "SignedHeaders=content-type;host, Signature=test") - .contentType(URLENC) - .formParam("Action", action) - .formParam("Version", "2014-10-31"); - } - @AfterEach void cleanUp() { for (String id : new String[]{RESTORED_INSTANCE, INSTANCE}) { diff --git a/src/test/java/io/github/hectorvent/floci/services/rds/RdsIamAuthLambdaSessionIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/rds/RdsIamAuthLambdaSessionIntegrationTest.java index 2daaea3d0a..d42dee4545 100644 --- a/src/test/java/io/github/hectorvent/floci/services/rds/RdsIamAuthLambdaSessionIntegrationTest.java +++ b/src/test/java/io/github/hectorvent/floci/services/rds/RdsIamAuthLambdaSessionIntegrationTest.java @@ -4,7 +4,6 @@ import com.github.dockerjava.api.DockerClient; import io.github.hectorvent.floci.services.iam.IamService; import io.github.hectorvent.floci.testutil.SigV4TokenTestHelper; import io.quarkus.test.junit.QuarkusTest; -import io.restassured.specification.RequestSpecification; import jakarta.inject.Inject; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Tag; @@ -19,8 +18,7 @@ import java.time.Duration; import java.time.Instant; import java.util.Properties; -import static io.restassured.RestAssured.given; -import static io.restassured.http.ContentType.URLENC; +import static io.github.hectorvent.floci.testing.RdsRequests.rds; import static org.awaitility.Awaitility.await; import static org.hamcrest.Matchers.containsString; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -39,9 +37,6 @@ import static org.junit.jupiter.api.Assumptions.assumeTrue; @Tag("docker") class RdsIamAuthLambdaSessionIntegrationTest { - private static final String RDS_AUTH = - "AWS4-HMAC-SHA256 Credential=test/20261002/us-east-1/rds/aws4_request, " - + "SignedHeaders=content-type;host, Signature=test"; private static final String ACCOUNT_ID = "000000000000"; private static final String MASTER_USER = "master"; private static final String MASTER_PASSWORD = "Master123!"; @@ -123,11 +118,4 @@ class RdsIamAuthLambdaSessionIntegrationTest { properties.setProperty("connectTimeout", "5"); return DriverManager.getConnection("jdbc:postgresql://127.0.0.1:" + port + "/" + DATABASE, properties); } - - private static RequestSpecification rds(String action) { - return given().header("Authorization", RDS_AUTH) - .contentType(URLENC) - .formParam("Action", action) - .formParam("Version", "2014-10-31"); - } } diff --git a/src/test/java/io/github/hectorvent/floci/services/rds/RdsInstanceMonitoringFieldsIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/rds/RdsInstanceMonitoringFieldsIntegrationTest.java index 6a9b29ec9c..cf554d889b 100644 --- a/src/test/java/io/github/hectorvent/floci/services/rds/RdsInstanceMonitoringFieldsIntegrationTest.java +++ b/src/test/java/io/github/hectorvent/floci/services/rds/RdsInstanceMonitoringFieldsIntegrationTest.java @@ -8,8 +8,7 @@ import io.restassured.specification.RequestSpecification; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Test; -import static io.restassured.RestAssured.given; -import static io.restassured.http.ContentType.URLENC; +import static io.github.hectorvent.floci.testing.RdsRequests.rds; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.not; @@ -31,15 +30,6 @@ class RdsInstanceMonitoringFieldsIntegrationTest { private static final String RESULT = "DescribeDBInstancesResponse.DescribeDBInstancesResult.DBInstances.DBInstance."; - private static RequestSpecification rds(String action) { - return given().header("Authorization", - "AWS4-HMAC-SHA256 Credential=test/20260615/us-east-1/rds/aws4_request, " - + "SignedHeaders=content-type;host, Signature=test") - .contentType(URLENC) - .formParam("Action", action) - .formParam("Version", "2014-10-31"); - } - private static RequestSpecification create() { return rds("CreateDBInstance") .formParam("DBInstanceIdentifier", ID) diff --git a/src/test/java/io/github/hectorvent/floci/services/rds/RdsInstanceScalingIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/rds/RdsInstanceScalingIntegrationTest.java index 0060869a3a..9e0913bb30 100644 --- a/src/test/java/io/github/hectorvent/floci/services/rds/RdsInstanceScalingIntegrationTest.java +++ b/src/test/java/io/github/hectorvent/floci/services/rds/RdsInstanceScalingIntegrationTest.java @@ -8,8 +8,7 @@ import io.restassured.specification.RequestSpecification; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Test; -import static io.restassured.RestAssured.given; -import static io.restassured.http.ContentType.URLENC; +import static io.github.hectorvent.floci.testing.RdsRequests.rds; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.equalTo; @@ -27,15 +26,6 @@ class RdsInstanceScalingIntegrationTest { private static final String RESULT = "DescribeDBInstancesResponse.DescribeDBInstancesResult.DBInstances.DBInstance."; - private static RequestSpecification rds(String action) { - return given().header("Authorization", - "AWS4-HMAC-SHA256 Credential=test/20260615/us-east-1/rds/aws4_request, " - + "SignedHeaders=content-type;host, Signature=test") - .contentType(URLENC) - .formParam("Action", action) - .formParam("Version", "2014-10-31"); - } - private static void create() { rds("CreateDBInstance") .formParam("DBInstanceIdentifier", ID)