diff --git a/compatibility-tests/sdk-test-go/tests/rds_test.go b/compatibility-tests/sdk-test-go/tests/rds_test.go index 5849b0c344..43f400b03a 100644 --- a/compatibility-tests/sdk-test-go/tests/rds_test.go +++ b/compatibility-tests/sdk-test-go/tests/rds_test.go @@ -11,6 +11,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws" "github.com/aws/aws-sdk-go-v2/service/rds" + "github.com/aws/aws-sdk-go-v2/service/rds/types" _ "github.com/lib/pq" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -106,7 +107,9 @@ func TestRDSInstance(t *testing.T) { assert.Equal(t, 1, result) }) - // Fix #567: deleting an instance must remove it from the describe list. + // Fix #567: deleting an instance must remove it from the describe list. Real AWS + // faults DBInstanceNotFound when describing a deleted instance by identifier — + // this is what lets the DBInstanceDeleted waiter complete. t.Run("DeleteDBInstance", func(t *testing.T) { _, err := svc.DeleteDBInstance(ctx, &rds.DeleteDBInstanceInput{ DBInstanceIdentifier: aws.String(instanceId), @@ -114,11 +117,12 @@ func TestRDSInstance(t *testing.T) { }) require.NoError(t, err) - out, err := svc.DescribeDBInstances(ctx, &rds.DescribeDBInstancesInput{ + _, err = svc.DescribeDBInstances(ctx, &rds.DescribeDBInstancesInput{ DBInstanceIdentifier: aws.String(instanceId), }) - require.NoError(t, err) - assert.Empty(t, out.DBInstances, "deleted instance must not appear in describe") + var notFound *types.DBInstanceNotFoundFault + require.ErrorAs(t, err, ¬Found, + "describe of a deleted instance must fault DBInstanceNotFound") }) } @@ -167,7 +171,9 @@ func TestRDSCluster(t *testing.T) { "DBCluster.DBSubnetGroup must be a non-nil string (shape: String in AWS service model)") }) - // Fix #567: deleting a cluster must remove it from the describe list. + // Fix #567: deleting a cluster must remove it from the describe list. Real AWS + // faults DBClusterNotFoundFault when describing a deleted cluster by identifier — + // this is what lets the DBClusterDeleted waiter complete. t.Run("DeleteDBCluster", func(t *testing.T) { _, err := svc.DeleteDBCluster(ctx, &rds.DeleteDBClusterInput{ DBClusterIdentifier: aws.String(clusterId), @@ -175,11 +181,12 @@ func TestRDSCluster(t *testing.T) { }) require.NoError(t, err) - out, err := svc.DescribeDBClusters(ctx, &rds.DescribeDBClustersInput{ + _, err = svc.DescribeDBClusters(ctx, &rds.DescribeDBClustersInput{ DBClusterIdentifier: aws.String(clusterId), }) - require.NoError(t, err) - assert.Empty(t, out.DBClusters, "deleted cluster must not appear in describe") + var notFound *types.DBClusterNotFoundFault + require.ErrorAs(t, err, ¬Found, + "describe of a deleted cluster must fault DBClusterNotFoundFault") }) } diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/RdsJdbcCompatTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/RdsJdbcCompatTest.java index 324ee10b5e..46cea3523b 100644 --- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/RdsJdbcCompatTest.java +++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/RdsJdbcCompatTest.java @@ -15,9 +15,9 @@ import software.amazon.awssdk.services.rds.RdsClient; import software.amazon.awssdk.services.rds.model.CreateDbInstanceRequest; import software.amazon.awssdk.services.rds.model.CreateDbInstanceResponse; import software.amazon.awssdk.services.rds.model.DBInstance; +import software.amazon.awssdk.services.rds.model.DbInstanceNotFoundException; import software.amazon.awssdk.services.rds.model.DeleteDbInstanceRequest; import software.amazon.awssdk.services.rds.model.DescribeDbInstancesRequest; -import software.amazon.awssdk.services.rds.model.DescribeDbInstancesResponse; import software.amazon.awssdk.services.rds.model.GenerateAuthenticationTokenRequest; import software.amazon.awssdk.services.rds.model.ModifyDbInstanceRequest; @@ -306,10 +306,13 @@ class RdsJdbcCompatTest { .build()); instanceCreated = false; - DescribeDbInstancesResponse afterDelete = rds.describeDBInstances(DescribeDbInstancesRequest.builder() - .dbInstanceIdentifier(instanceId) - .build()); - assertThat(afterDelete.dbInstances()).isEmpty(); + // Real AWS faults DBInstanceNotFound when describing a deleted instance by + // identifier — this is what lets the DBInstanceDeleted waiter complete. + String deletedId = instanceId; + assertThatThrownBy(() -> rds.describeDBInstances(DescribeDbInstancesRequest.builder() + .dbInstanceIdentifier(deletedId) + .build())) + .isInstanceOf(DbInstanceNotFoundException.class); String replacementId = TestFixtures.uniqueName("rds-pg"); CreateDbInstanceResponse replacement = rds.createDBInstance(CreateDbInstanceRequest.builder() diff --git a/src/main/java/io/github/hectorvent/floci/services/docdb/DocDbQueryHandler.java b/src/main/java/io/github/hectorvent/floci/services/docdb/DocDbQueryHandler.java index 13ae93b732..85e936c5ea 100644 --- a/src/main/java/io/github/hectorvent/floci/services/docdb/DocDbQueryHandler.java +++ b/src/main/java/io/github/hectorvent/floci/services/docdb/DocDbQueryHandler.java @@ -75,14 +75,17 @@ public class DocDbQueryHandler { } private Response handleDescribeDbClusters(MultivaluedMap params) { - String filterId = params.getFirst("DBClusterIdentifier"); + String identifier = params.getFirst("DBClusterIdentifier"); + String filterId = identifier; if (filterId == null || filterId.isBlank()) { filterId = extractFilterValue(params, "db-cluster-id"); } - // When a specific cluster ID is requested, AWS returns 404 if not found - if (filterId != null && !filterId.isBlank()) { - service.getDbCluster(filterId); // throws DBClusterNotFoundFault if absent + // AWS parity: the DBClusterIdentifier parameter faults with + // DBClusterNotFoundFault when no cluster matches, while the + // db-cluster-id Filters form returns an empty list. + if (identifier != null && !identifier.isBlank()) { + service.getDbCluster(identifier); // throws DBClusterNotFoundFault if absent } Collection result = service.listDbClusters(filterId); @@ -154,13 +157,17 @@ public class DocDbQueryHandler { } private Response handleDescribeDbInstances(MultivaluedMap params) { - String filterId = params.getFirst("DBInstanceIdentifier"); + String identifier = params.getFirst("DBInstanceIdentifier"); + String filterId = identifier; if (filterId == null || filterId.isBlank()) { filterId = extractFilterValue(params, "db-instance-id"); } - if (filterId != null && !filterId.isBlank()) { - service.getDbInstance(filterId); // throws DBInstanceNotFound if absent + // AWS parity: the DBInstanceIdentifier parameter faults with + // DBInstanceNotFound when no instance matches, while the + // db-instance-id Filters form returns an empty list. + if (identifier != null && !identifier.isBlank()) { + service.getDbInstance(identifier); // throws DBInstanceNotFound if absent } Collection result = service.listDbInstances(filterId); diff --git a/src/main/java/io/github/hectorvent/floci/services/docdb/DocDbService.java b/src/main/java/io/github/hectorvent/floci/services/docdb/DocDbService.java index 82ede0b73b..cf2462af24 100644 --- a/src/main/java/io/github/hectorvent/floci/services/docdb/DocDbService.java +++ b/src/main/java/io/github/hectorvent/floci/services/docdb/DocDbService.java @@ -116,6 +116,15 @@ public class DocDbService { public Collection listDbClusters(String filterId) { if (filterId != null && !filterId.isBlank()) { + // The db-cluster-id filter accepts ARNs as well as identifiers. Match the + // full ARN against each cluster's stored ARN rather than reducing it to + // the bare identifier, so a cross-account or cross-region ARN does not + // resolve a same-named local cluster. + if (filterId.startsWith("arn:")) { + return clusters.scan(k -> true).stream() + .filter(c -> filterId.equalsIgnoreCase(c.getDbClusterArn())) + .toList(); + } return clusters.scan(k -> k.equalsIgnoreCase(filterId)); } return clusters.scan(k -> true); @@ -200,6 +209,13 @@ public class DocDbService { public Collection listDbInstances(String filterId) { if (filterId != null && !filterId.isBlank()) { + // The db-instance-id filter accepts ARNs as well as identifiers; see + // listDbClusters for why the match is against the stored ARN. + if (filterId.startsWith("arn:")) { + return instances.scan(k -> true).stream() + .filter(i -> filterId.equalsIgnoreCase(i.getDbInstanceArn())) + .toList(); + } return instances.scan(k -> k.equalsIgnoreCase(filterId)); } return instances.scan(k -> true); diff --git a/src/main/java/io/github/hectorvent/floci/services/neptune/NeptuneQueryHandler.java b/src/main/java/io/github/hectorvent/floci/services/neptune/NeptuneQueryHandler.java index 4eed595fa5..6250673c64 100644 --- a/src/main/java/io/github/hectorvent/floci/services/neptune/NeptuneQueryHandler.java +++ b/src/main/java/io/github/hectorvent/floci/services/neptune/NeptuneQueryHandler.java @@ -69,14 +69,17 @@ public class NeptuneQueryHandler { } private Response handleDescribeDbClusters(MultivaluedMap params) { - String filterId = params.getFirst("DBClusterIdentifier"); + String identifier = params.getFirst("DBClusterIdentifier"); + String filterId = identifier; if (filterId == null || filterId.isBlank()) { filterId = extractFilterValue(params, "db-cluster-id"); } - // When a specific cluster ID is requested, AWS returns 404 if not found - if (filterId != null && !filterId.isBlank()) { - service.getDbCluster(filterId); // throws DBClusterNotFoundFault if absent + // AWS parity: the DBClusterIdentifier parameter faults with + // DBClusterNotFoundFault when no cluster matches, while the + // db-cluster-id Filters form returns an empty list. + if (identifier != null && !identifier.isBlank()) { + service.getDbCluster(identifier); // throws DBClusterNotFoundFault if absent } Collection result = service.listDbClusters(filterId); @@ -140,13 +143,17 @@ public class NeptuneQueryHandler { } private Response handleDescribeDbInstances(MultivaluedMap params) { - String filterId = params.getFirst("DBInstanceIdentifier"); + String identifier = params.getFirst("DBInstanceIdentifier"); + String filterId = identifier; if (filterId == null || filterId.isBlank()) { filterId = extractFilterValue(params, "db-instance-id"); } - if (filterId != null && !filterId.isBlank()) { - service.getDbInstance(filterId); // throws DBInstanceNotFound if absent + // AWS parity: the DBInstanceIdentifier parameter faults with + // DBInstanceNotFound when no instance matches, while the + // db-instance-id Filters form returns an empty list. + if (identifier != null && !identifier.isBlank()) { + service.getDbInstance(identifier); // throws DBInstanceNotFound if absent } Collection result = service.listDbInstances(filterId); diff --git a/src/main/java/io/github/hectorvent/floci/services/neptune/NeptuneService.java b/src/main/java/io/github/hectorvent/floci/services/neptune/NeptuneService.java index 765f0823c4..a3bdf7088a 100644 --- a/src/main/java/io/github/hectorvent/floci/services/neptune/NeptuneService.java +++ b/src/main/java/io/github/hectorvent/floci/services/neptune/NeptuneService.java @@ -173,6 +173,15 @@ public class NeptuneService { public Collection listDbClusters(String filterId) { if (filterId != null && !filterId.isBlank()) { + // The db-cluster-id filter accepts ARNs as well as identifiers. Match the + // full ARN against each cluster's stored ARN rather than reducing it to + // the bare identifier, so a cross-account or cross-region ARN does not + // resolve a same-named local cluster. + if (filterId.startsWith("arn:")) { + return clusters.scan(k -> true).stream() + .filter(c -> filterId.equalsIgnoreCase(c.getDbClusterArn())) + .toList(); + } return clusters.scan(k -> k.equalsIgnoreCase(filterId)); } return clusters.scan(k -> true); @@ -260,6 +269,13 @@ public class NeptuneService { public Collection listDbInstances(String filterId) { if (filterId != null && !filterId.isBlank()) { + // The db-instance-id filter accepts ARNs as well as identifiers; see + // listDbClusters for why the match is against the stored ARN. + if (filterId.startsWith("arn:")) { + return instances.scan(k -> true).stream() + .filter(i -> filterId.equalsIgnoreCase(i.getDbInstanceArn())) + .toList(); + } return instances.scan(k -> k.equalsIgnoreCase(filterId)); } return instances.scan(k -> true); diff --git a/src/main/java/io/github/hectorvent/floci/services/rds/RdsQueryHandler.java b/src/main/java/io/github/hectorvent/floci/services/rds/RdsQueryHandler.java index 21507f7f4f..27ae091a14 100644 --- a/src/main/java/io/github/hectorvent/floci/services/rds/RdsQueryHandler.java +++ b/src/main/java/io/github/hectorvent/floci/services/rds/RdsQueryHandler.java @@ -138,12 +138,20 @@ public class RdsQueryHandler { } private Response handleDescribeDbInstances(MultivaluedMap params) { - String filterId = params.getFirst("DBInstanceIdentifier"); + String identifier = params.getFirst("DBInstanceIdentifier"); + String filterId = identifier; if (filterId == null || filterId.isBlank()) { filterId = extractRdsFilterValue(params, "db-instance-id"); } try { Collection result = service.listDbInstances(filterId); + // AWS parity: the DBInstanceIdentifier PARAMETER faults with + // DBInstanceNotFound when no instance matches, while the + // db-instance-id Filters form returns an empty list. + if (identifier != null && !identifier.isBlank() && result.isEmpty()) { + throw new AwsException("DBInstanceNotFound", + "DBInstance " + identifier + " not found.", 404); + } XmlBuilder xml = new XmlBuilder().start("DBInstances"); for (DbInstance i : result) { xml.start("DBInstance").raw(dbInstanceInnerXml(i)).end("DBInstance"); @@ -357,12 +365,20 @@ public class RdsQueryHandler { } private Response handleDescribeDbClusters(MultivaluedMap params) { - String filterId = params.getFirst("DBClusterIdentifier"); + String identifier = params.getFirst("DBClusterIdentifier"); + String filterId = identifier; if (filterId == null || filterId.isBlank()) { filterId = extractRdsFilterValue(params, "db-cluster-id"); } try { Collection result = service.listDbClusters(filterId); + // AWS parity: the DBClusterIdentifier PARAMETER faults with + // DBClusterNotFoundFault when no cluster matches, while the + // db-cluster-id Filters form returns an empty list. + if (identifier != null && !identifier.isBlank() && result.isEmpty()) { + throw new AwsException("DBClusterNotFoundFault", + "DBCluster " + identifier + " not found.", 404); + } XmlBuilder xml = new XmlBuilder().start("DBClusters"); for (DbCluster c : result) { xml.start("DBCluster").raw(dbClusterInnerXml(c)).end("DBCluster"); diff --git a/src/main/java/io/github/hectorvent/floci/services/rds/RdsService.java b/src/main/java/io/github/hectorvent/floci/services/rds/RdsService.java index a2ed77be7b..53f38a7893 100644 --- a/src/main/java/io/github/hectorvent/floci/services/rds/RdsService.java +++ b/src/main/java/io/github/hectorvent/floci/services/rds/RdsService.java @@ -523,6 +523,15 @@ public class RdsService implements Resettable { public Collection listDbInstances(String filterId) { if (filterId != null && !filterId.isBlank()) { + // DBInstanceIdentifier also accepts an ARN per the AWS model. Match the + // full ARN against each instance's stored ARN rather than reducing it to + // the bare identifier, so a cross-account or cross-region ARN does not + // resolve a same-named local instance. + if (filterId.startsWith("arn:")) { + return instances.scan(k -> true).stream() + .filter(i -> filterId.equalsIgnoreCase(i.getDbInstanceArn())) + .toList(); + } return instances.scan(k -> k.equalsIgnoreCase(filterId)); } return instances.scan(k -> true); @@ -747,6 +756,15 @@ public class RdsService implements Resettable { public Collection listDbClusters(String filterId) { if (filterId != null && !filterId.isBlank()) { + // DBClusterIdentifier also accepts an ARN per the AWS model. Match the + // full ARN against each cluster's stored ARN rather than reducing it to + // the bare identifier, so a cross-account or cross-region ARN does not + // resolve a same-named local cluster. + if (filterId.startsWith("arn:")) { + return clusters.scan(k -> true).stream() + .filter(c -> filterId.equalsIgnoreCase(c.getDbClusterArn())) + .toList(); + } return clusters.scan(k -> k.equalsIgnoreCase(filterId)); } return clusters.scan(k -> true); diff --git a/src/test/java/io/github/hectorvent/floci/services/docdb/DocDbIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/docdb/DocDbIntegrationTest.java index 831f4db4a6..18d13e1ee4 100644 --- a/src/test/java/io/github/hectorvent/floci/services/docdb/DocDbIntegrationTest.java +++ b/src/test/java/io/github/hectorvent/floci/services/docdb/DocDbIntegrationTest.java @@ -334,4 +334,40 @@ class DocDbIntegrationTest { .statusCode(200) .body(containsString(RDS_SCOPE_CLUSTER_ID)); } + + // The db-cluster-id / db-instance-id Filters form returns an empty list for a + // missing id, unlike the DBClusterIdentifier / DBInstanceIdentifier parameter + // which faults with 404. Mirrors AWS and the RDS behaviour. + + @Test + @Order(20) + void describeClustersByFilterReturnsEmptyForMissing() { + given() + .header("Authorization", AUTH) + .contentType(FORM) + .formParam("Action", "DescribeDBClusters") + .formParam("Filters.Filter.1.Name", "db-cluster-id") + .formParam("Filters.Filter.1.Values.Value.1", "nonexistent-cluster") + .when().post("/") + .then() + .statusCode(200) + .body(containsString(" new InMemoryStorage<>()); when(containerManager.start(anyString(), anyString(), any(NeptuneDbType.class))) @@ -143,6 +141,32 @@ class NeptuneServiceTest { "Port from the failed create must be released so the next cluster reuses it"); } + @Test + void listDbClustersMatchesByArnButNotForeignArn() { + NeptuneCluster cluster = service.createDbCluster("my-cluster", "1.3.2.1", false); + + String arn = cluster.getDbClusterArn(); + assertEquals(1, service.listDbClusters(arn).size()); + assertTrue(service.listDbClusters(arn.replace("000000000000", "999999999999")).isEmpty(), + "cross-account ARN must not match"); + assertTrue(service.listDbClusters(arn.replace("us-east-1", "eu-west-1")).isEmpty(), + "cross-region ARN must not match"); + } + + @Test + void listDbInstancesMatchesByArnButNotForeignArn() { + service.createDbCluster("my-cluster", "1.3.2.1", false); + NeptuneInstance instance = service.createDbInstance( + "my-instance", "my-cluster", "db.r5.large", null, false); + + String arn = instance.getDbInstanceArn(); + assertEquals(1, service.listDbInstances(arn).size()); + assertTrue(service.listDbInstances(arn.replace("000000000000", "999999999999")).isEmpty(), + "cross-account ARN must not match"); + assertTrue(service.listDbInstances(arn.replace("us-east-1", "eu-west-1")).isEmpty(), + "cross-region ARN must not match"); + } + @Test void exhaustedProxyPortRangeThrowsMappableCapacityFault() { // Shrink the range to one port so the second create exhausts it. diff --git a/src/test/java/io/github/hectorvent/floci/services/rds/RdsQueryHandlerTest.java b/src/test/java/io/github/hectorvent/floci/services/rds/RdsQueryHandlerTest.java index ec484ba433..06f383b747 100644 --- a/src/test/java/io/github/hectorvent/floci/services/rds/RdsQueryHandlerTest.java +++ b/src/test/java/io/github/hectorvent/floci/services/rds/RdsQueryHandlerTest.java @@ -785,6 +785,72 @@ class RdsQueryHandlerTest { assertTrue(((String) response.getEntity()).contains("DBSubnetGroupNotFoundFault")); } + // ─────────────── NotFound faults for missing identifiers (AWS parity) ─────────────── + + @Test + void describeDbInstances_missingIdentifierFaultsWithDbInstanceNotFound() { + when(service.listDbInstances("missing")).thenReturn(List.of()); + + MultivaluedMap p = params(); + p.add("DBInstanceIdentifier", "missing"); + Response response = handler.handle("DescribeDBInstances", p); + + assertEquals(404, response.getStatus()); + String body = (String) response.getEntity(); + assertTrue(body.contains("DBInstanceNotFound"), + "Expected DBInstanceNotFound error code, got: " + body); + assertTrue(body.contains("DBInstance missing not found."), + "Expected AWS-style message, got: " + body); + } + + @Test + void describeDbInstances_filtersFormReturnsEmptyListForMissing() { + when(service.listDbInstances("missing")).thenReturn(List.of()); + + MultivaluedMap p = params(); + p.add("Filters.Filter.1.Name", "db-instance-id"); + p.add("Filters.Filter.1.Values.Value.1", "missing"); + Response response = handler.handle("DescribeDBInstances", p); + + assertEquals(200, response.getStatus()); + String body = (String) response.getEntity(); + assertTrue(body.contains(""), + "Filters form must return an empty list, not fault: " + body); + assertFalse(body.contains("DBInstanceNotFound")); + } + + @Test + void describeDbClusters_missingIdentifierFaultsWithDbClusterNotFoundFault() { + when(service.listDbClusters("missing")).thenReturn(List.of()); + + MultivaluedMap p = params(); + p.add("DBClusterIdentifier", "missing"); + Response response = handler.handle("DescribeDBClusters", p); + + assertEquals(404, response.getStatus()); + String body = (String) response.getEntity(); + assertTrue(body.contains("DBClusterNotFoundFault"), + "Expected DBClusterNotFoundFault error code, got: " + body); + assertTrue(body.contains("DBCluster missing not found."), + "Expected AWS-style message, got: " + body); + } + + @Test + void describeDbClusters_filtersFormReturnsEmptyListForMissing() { + when(service.listDbClusters("missing")).thenReturn(List.of()); + + MultivaluedMap p = params(); + p.add("Filters.Filter.1.Name", "db-cluster-id"); + p.add("Filters.Filter.1.Values.Value.1", "missing"); + Response response = handler.handle("DescribeDBClusters", p); + + assertEquals(200, response.getStatus()); + String body = (String) response.getEntity(); + assertTrue(body.contains(""), + "Filters form must return an empty list, not fault: " + body); + assertFalse(body.contains("DBClusterNotFoundFault")); + } + // ──────────────────────────── Helpers ──────────────────────────── private static MultivaluedMap params() { diff --git a/src/test/java/io/github/hectorvent/floci/services/rds/RdsServiceTest.java b/src/test/java/io/github/hectorvent/floci/services/rds/RdsServiceTest.java index 7e2cc3ca2c..1720e86641 100644 --- a/src/test/java/io/github/hectorvent/floci/services/rds/RdsServiceTest.java +++ b/src/test/java/io/github/hectorvent/floci/services/rds/RdsServiceTest.java @@ -270,6 +270,50 @@ class RdsServiceTest { assertTrue(result.isEmpty()); } + @Test + void listDbInstancesMatchesByArn() { + DbInstance created = rdsService.createDbInstance("mydb", "postgres", "13", + "admin", "password", "dbname", "db.t3.micro", + 20, false, null, null, null, null, false); + + Collection result = rdsService.listDbInstances(created.getDbInstanceArn()); + assertEquals(1, result.size()); + assertEquals("mydb", result.iterator().next().getDbInstanceIdentifier()); + } + + @Test + void listDbClustersMatchesByArn() { + DbCluster created = rdsService.createDbCluster("cluster1", "aurora-postgresql", "16.3", + "admin", "password", "dbname", false, null); + + Collection result = rdsService.listDbClusters(created.getDbClusterArn()); + assertEquals(1, result.size()); + assertEquals("cluster1", result.iterator().next().getDbClusterIdentifier()); + } + + @Test + void listDbInstancesDoesNotMatchForeignArn() { + rdsService.createDbInstance("mydb", "postgres", "13", + "admin", "password", "dbname", "db.t3.micro", + 20, false, null, null, null, null, false); + + assertTrue(rdsService.listDbInstances( + "arn:aws:rds:us-east-1:999999999999:db:mydb").isEmpty(), "cross-account ARN must not match"); + assertTrue(rdsService.listDbInstances( + "arn:aws:rds:eu-west-1:123456789012:db:mydb").isEmpty(), "cross-region ARN must not match"); + } + + @Test + void listDbClustersDoesNotMatchForeignArn() { + rdsService.createDbCluster("cluster1", "aurora-postgresql", "16.3", + "admin", "password", "dbname", false, null); + + assertTrue(rdsService.listDbClusters( + "arn:aws:rds:us-east-1:999999999999:cluster:cluster1").isEmpty(), "cross-account ARN must not match"); + assertTrue(rdsService.listDbClusters( + "arn:aws:rds:eu-west-1:123456789012:cluster:cluster1").isEmpty(), "cross-region ARN must not match"); + } + @Test void modifyDbInstanceBlankPasswordDoesNotOverwriteExistingPassword() { rdsService.createDbInstance("mydb", "postgres", "13",