mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
fix(rds): align create-time parameter group validation with AWS behavior (#1330)
This commit is contained in:
1 parent
ab6d7feb9d
commit
e8f7cc470e
3 files changed
+107
-11
No files matched your search
@@ -340,7 +340,7 @@ class RdsQueryHandlerTest {
|
||||
eq(null), eq(null), eq(null), eq("db.t3.micro"),
|
||||
eq(20), eq(false), eq(null), eq(null), eq(null), eq(false), eq(null), eq(java.util.Map.of())))
|
||||
.thenThrow(new AwsException("InvalidParameterValue",
|
||||
"Unsupported engine: oracle. Supported: postgres, mysql, mariadb.", 400));
|
||||
"A value that you provided for a parameter isn't valid. Check the parameter constraints and try again.", 400));
|
||||
|
||||
MultivaluedMap<String, String> p = params();
|
||||
p.add("DBInstanceIdentifier", "mydb");
|
||||
@@ -349,6 +349,7 @@ class RdsQueryHandlerTest {
|
||||
|
||||
assertEquals(400, response.getStatus());
|
||||
assertTrue(((String) response.getEntity()).contains("InvalidParameterValue"));
|
||||
assertTrue(((String) response.getEntity()).contains("Check the parameter constraints and try again."));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -165,6 +165,29 @@ class RdsServiceTest {
|
||||
assertTrue(secretString.getValue().contains("\"dbInstanceIdentifier\":\"mydb\""));
|
||||
}
|
||||
|
||||
@Test
|
||||
void createDbInstanceRejectsUnknownParameterGroup() {
|
||||
AwsException exception = assertThrows(AwsException.class, () -> rdsService.createDbInstance("mydb", "postgres", "13",
|
||||
"admin", "password", "dbname", "db.t3.micro",
|
||||
20, false, "does-not-exist", null, null));
|
||||
|
||||
assertEquals("DBParameterGroupNotFound", exception.getErrorCode());
|
||||
assertEquals("DBParameterGroupName doesn't refer to an existing DB parameter group.", exception.getMessage());
|
||||
}
|
||||
|
||||
@Test
|
||||
void createDbInstanceRejectsIncompatibleParameterGroupFamily() {
|
||||
rdsService.createDbParameterGroup("pg1", "mysql8.0", "test group");
|
||||
|
||||
AwsException exception = assertThrows(AwsException.class, () -> rdsService.createDbInstance("mydb", "postgres", "13",
|
||||
"admin", "password", "dbname", "db.t3.micro",
|
||||
20, false, "pg1", null, null));
|
||||
|
||||
assertEquals("InvalidParameterCombination", exception.getErrorCode());
|
||||
assertEquals("Parameters that must not be used together were used together. Remove one of the conflicting parameters and try again.",
|
||||
exception.getMessage());
|
||||
}
|
||||
|
||||
@Test
|
||||
void listDbInstancesIsCaseInsensitive() {
|
||||
rdsService.createDbInstance("mydb", "postgres", "13",
|
||||
@@ -296,6 +319,27 @@ class RdsServiceTest {
|
||||
assertTrue(exception.getMessage().contains("still has DB instances"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void createDbClusterRejectsUnknownClusterParameterGroup() {
|
||||
AwsException exception = assertThrows(AwsException.class, () -> rdsService.createDbCluster("cluster1", "aurora-postgresql", "16.3",
|
||||
"admin", "password", "dbname", false, "does-not-exist"));
|
||||
|
||||
assertEquals("DBClusterParameterGroupNotFound", exception.getErrorCode());
|
||||
assertEquals("DBClusterParameterGroupName doesn't refer to an existing DB cluster parameter group.", exception.getMessage());
|
||||
}
|
||||
|
||||
@Test
|
||||
void createDbClusterRejectsIncompatibleClusterParameterGroupFamily() {
|
||||
rdsService.createDbClusterParameterGroup("cpg1", "aurora-mysql8.0", "test group");
|
||||
|
||||
AwsException exception = assertThrows(AwsException.class, () -> rdsService.createDbCluster("cluster1", "aurora-postgresql", "16.3",
|
||||
"admin", "password", "dbname", false, "cpg1"));
|
||||
|
||||
assertEquals("InvalidParameterCombination", exception.getErrorCode());
|
||||
assertEquals("Parameters that must not be used together were used together. Remove one of the conflicting parameters and try again.",
|
||||
exception.getMessage());
|
||||
}
|
||||
|
||||
@Test
|
||||
void createDbClusterParameterGroupRoundTrip() {
|
||||
DbClusterParameterGroup created = rdsService.createDbClusterParameterGroup(
|
||||
@@ -337,7 +381,8 @@ class RdsServiceTest {
|
||||
AwsException exception = assertThrows(AwsException.class, () ->
|
||||
rdsService.deleteDbClusterParameterGroup("nonexistent"));
|
||||
|
||||
assertEquals("DBParameterGroupNotFound", exception.getErrorCode());
|
||||
assertEquals("DBClusterParameterGroupNotFound", exception.getErrorCode());
|
||||
assertEquals("DBClusterParameterGroupName doesn't refer to an existing DB cluster parameter group.", exception.getMessage());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -345,7 +390,8 @@ class RdsServiceTest {
|
||||
AwsException exception = assertThrows(AwsException.class, () ->
|
||||
rdsService.getDbClusterParameterGroup("nonexistent"));
|
||||
|
||||
assertEquals("DBParameterGroupNotFound", exception.getErrorCode());
|
||||
assertEquals("DBClusterParameterGroupNotFound", exception.getErrorCode());
|
||||
assertEquals("DBClusterParameterGroupName doesn't refer to an existing DB cluster parameter group.", exception.getMessage());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in new issue
Block a user