fix(rds): align subnet group placement handling with AWS behavior (#1295)

* fix(rds): align subnet group placement handling with AWS behavior

* fix(rds): align DB subnet group wire responses with AWS model

* fix(rds): align subnet group placement validation with AWS

* fix(rds): tighten subnet group placement validation

* chore: rerun ci
This commit is contained in:
shrimptails-f authored and GitHub committed 2026-06-25 17:54:50 -05:00
1 parent 82170dd081
commit ad1cc22c19
9 files changed
+708 -142

No files matched your search

@@ -4,11 +4,15 @@ import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import software.amazon.awssdk.services.ec2.Ec2Client;
import software.amazon.awssdk.services.ec2.model.DescribeSubnetsResponse;
import software.amazon.awssdk.services.rds.RdsClient;
import software.amazon.awssdk.services.rds.model.CreateDbSubnetGroupResponse;
import software.amazon.awssdk.services.rds.model.DescribeDbSubnetGroupsResponse;
import software.amazon.awssdk.services.rds.model.DescribeOrderableDbInstanceOptionsResponse;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
@DisplayName("RDS Control Plane")
@@ -16,11 +20,21 @@ class RdsControlPlaneTest {
private static RdsClient rds;
private static String subnetGroupName;
private static List<String> subnetIds;
@BeforeAll
static void setup() {
rds = TestFixtures.rdsClient();
subnetGroupName = TestFixtures.uniqueName("rds-subnets");
try (Ec2Client ec2 = TestFixtures.ec2Client()) {
DescribeSubnetsResponse response = ec2.describeSubnets();
subnetIds = response.subnets().stream()
.map(subnet -> subnet.subnetId())
.sorted()
.limit(2)
.toList();
}
assertThat(subnetIds).hasSizeGreaterThanOrEqualTo(2);
}
@AfterAll
@@ -39,11 +53,11 @@ class RdsControlPlaneTest {
CreateDbSubnetGroupResponse createResponse = rds.createDBSubnetGroup(b -> b
.dbSubnetGroupName(subnetGroupName)
.dbSubnetGroupDescription("SDK subnet group shape")
.subnetIds("subnet-a", "subnet-b"));
.subnetIds(subnetIds));
assertThat(createResponse.dbSubnetGroup().subnets())
.extracting("subnetIdentifier")
.containsExactly("subnet-a", "subnet-b");
.containsExactlyElementsOf(subnetIds);
DescribeDbSubnetGroupsResponse describeResponse = rds.describeDBSubnetGroups(b -> b
.dbSubnetGroupName(subnetGroupName));
@@ -51,7 +65,7 @@ class RdsControlPlaneTest {
assertThat(describeResponse.dbSubnetGroups()).hasSize(1);
assertThat(describeResponse.dbSubnetGroups().get(0).subnets())
.extracting("subnetIdentifier")
.containsExactly("subnet-a", "subnet-b");
.containsExactlyElementsOf(subnetIds);
}
@Test