mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
refactor(rds): read the read replica source ARN through AwsArnUtils.parse (#6887)
resolveReadReplicaSource split the source ARN by hand right under the looksLikeArn check. AwsArnUtils.parse gives the same partition, region, account and db:<name> resource; an ARN that is truncated, names another account or names a cluster still finds no source. Signed-off-by: Hector Ventura <hectorvent@gmail.com>
This commit is contained in:
1 parent
63aa7710d0
commit
42e7f6f2f3
2 files changed
+18
-5
No files matched your search
@@ -10156,6 +10156,19 @@ class RdsServiceTest {
|
||||
"a refused request leaves no dangling link on the source");
|
||||
}
|
||||
|
||||
@Test
|
||||
void createReadReplicaFindsNoSourceForAnArnThatIsNotThisAccountsInstance() {
|
||||
createPostgresSource("primary");
|
||||
|
||||
for (String source : List.of("arn:aws:rds:us-east-1:123456789012:db",
|
||||
"arn:aws:rds:us-east-1:999999999999:db:primary",
|
||||
"arn:aws:rds:us-east-1:123456789012:cluster:primary")) {
|
||||
AwsException notFound = assertThrows(AwsException.class, () ->
|
||||
rdsService.createDbInstanceReadReplica(replicaRequest("r", source), null));
|
||||
assertEquals("DBInstanceNotFound", notFound.getErrorCode(), source);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void createReadReplicaRollsBackWhenTheCopyFails() {
|
||||
createPostgresSource("primary");
|
||||
|
||||
Reference in new issue
Block a user