mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
fix(rds): restrict custom endpoint mutations to Aurora (#5206)
* fix(rds): restrict cluster endpoints to Aurora * fix(rds): preserve legacy cluster endpoints * fix(rds): align cluster endpoint restrictions
This commit is contained in:
1 parent
9d49e619c1
commit
d8b170a144
2 files changed
+48
No files matched your search
@@ -62,6 +62,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.OptionalInt;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
@@ -8428,6 +8429,44 @@ class RdsServiceTest {
|
||||
assertEquals("moved.example", moved.getEndpoint());
|
||||
}
|
||||
|
||||
@Test
|
||||
void customClusterEndpointMutationsRequireAurora() {
|
||||
rdsService.createDbCluster("plain", "postgres", "17.5", "admin", "password", "appdb", false, null);
|
||||
|
||||
AwsException createError = assertThrows(AwsException.class, () ->
|
||||
rdsService.createDbClusterEndpoint("us-east-1", "plain", "reports", "ANY",
|
||||
List.of(), List.of(), Map.of()));
|
||||
assertEquals("InvalidParameterValue", createError.getErrorCode());
|
||||
assertEquals(Set.of("WRITER", "READER"), rdsService.describeDbClusterEndpoints(
|
||||
"us-east-1", "plain", null, Map.of(), null, null).endpoints().stream()
|
||||
.map(DbClusterEndpoint::getEndpointType)
|
||||
.collect(Collectors.toSet()));
|
||||
|
||||
DbCluster aurora = rdsService.createDbCluster(
|
||||
"aurora", "aurora-postgresql", "16.3", "admin", "password", "appdb", false, null);
|
||||
rdsService.createDbClusterEndpoint("us-east-1", "aurora", "legacy", "ANY",
|
||||
List.of(), List.of(), Map.of());
|
||||
aurora.setEngineIdentifier("postgres");
|
||||
|
||||
AwsException modifyError = assertThrows(AwsException.class, () ->
|
||||
rdsService.modifyDbClusterEndpoint("us-east-1", "legacy", "READER", null, null));
|
||||
assertEquals("InvalidParameterValue", modifyError.getErrorCode());
|
||||
List<DbClusterEndpoint> existing = rdsService.describeDbClusterEndpoints(
|
||||
"us-east-1", "aurora", null, Map.of(), null, null).endpoints();
|
||||
assertEquals(Set.of("WRITER", "READER", "CUSTOM"), existing.stream()
|
||||
.map(DbClusterEndpoint::getEndpointType)
|
||||
.collect(Collectors.toSet()));
|
||||
assertEquals("deleting", rdsService.deleteDbClusterEndpoint("us-east-1", "legacy").getStatus());
|
||||
|
||||
aurora.setEngineIdentifier(null);
|
||||
AwsException legacyCreateError = assertThrows(AwsException.class, () ->
|
||||
rdsService.createDbClusterEndpoint("us-east-1", "aurora", "restored", "ANY",
|
||||
List.of(), List.of(), Map.of()));
|
||||
assertEquals("InvalidParameterValue", legacyCreateError.getErrorCode());
|
||||
assertEquals(2, rdsService.describeDbClusterEndpoints(
|
||||
"us-east-1", "aurora", null, Map.of(), null, null).endpoints().size());
|
||||
}
|
||||
|
||||
@Test
|
||||
void failoverDbClusterMovesTheWriterRole() {
|
||||
rdsService.createDbCluster("aurora", "aurora-postgresql", "16.3", "admin", "password", "appdb", false, null);
|
||||
|
||||
Reference in new issue
Block a user