mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
fix(rds): accept the master usernames each engine really allows (#3730)
The 16 character cap was applied to every engine, but RDS accepts 63 on PostgreSQL and 32 on MySQL, so an instance whose master username is longer could not be created at all. The bound now comes from DatabaseEngine, using the engine createDbInstance already resolves; the character rule and the error message are unchanged. Closes #3729
This commit is contained in:
1 parent
f99e507916
commit
f48bc2aa40
4 files changed
+74
-2
No files matched your search
@@ -2760,11 +2760,44 @@ class RdsServiceTest {
|
||||
|
||||
AwsException ex4 = assertThrows(AwsException.class, () ->
|
||||
rdsService.createDbInstance("mydb4", "postgres", "13",
|
||||
"a1234567890123456", "password", "dbname", "db.t3.micro",
|
||||
"a" + "b".repeat(63), "password", "dbname", "db.t3.micro",
|
||||
20, false, null, null, null, null, false));
|
||||
assertEquals("InvalidParameterValue", ex4.getErrorCode());
|
||||
}
|
||||
|
||||
@Test
|
||||
void createDbInstanceAcceptsTheLongestMasterUsernameEachEngineAllows() {
|
||||
DbInstance postgres = rdsService.createDbInstance("pg63", "postgres", "13",
|
||||
"a" + "b".repeat(62), "password", "dbname", "db.t3.micro",
|
||||
20, false, null, null, null, null, false);
|
||||
assertEquals(63, postgres.getMasterUsername().length());
|
||||
|
||||
DbInstance mysql = rdsService.createDbInstance("my32", "mysql", "8.0",
|
||||
"a" + "b".repeat(31), "password", "dbname", "db.t3.micro",
|
||||
20, false, null, null, null, null, false);
|
||||
assertEquals(32, mysql.getMasterUsername().length());
|
||||
|
||||
DbInstance mariadb = rdsService.createDbInstance("mar16", "mariadb", "11.4",
|
||||
"a" + "b".repeat(15), "password", "dbname", "db.t3.micro",
|
||||
20, false, null, null, null, null, false);
|
||||
assertEquals(16, mariadb.getMasterUsername().length());
|
||||
}
|
||||
|
||||
@Test
|
||||
void createDbInstanceRejectsMasterUsernameLongerThanTheEngineAllows() {
|
||||
AwsException mysql = assertThrows(AwsException.class, () ->
|
||||
rdsService.createDbInstance("my33", "mysql", "8.0",
|
||||
"a" + "b".repeat(32), "password", "dbname", "db.t3.micro",
|
||||
20, false, null, null, null, null, false));
|
||||
assertEquals("InvalidParameterValue", mysql.getErrorCode());
|
||||
|
||||
AwsException mariadb = assertThrows(AwsException.class, () ->
|
||||
rdsService.createDbInstance("mar17", "mariadb", "11.4",
|
||||
"a" + "b".repeat(16), "password", "dbname", "db.t3.micro",
|
||||
20, false, null, null, null, null, false));
|
||||
assertEquals("InvalidParameterValue", mariadb.getErrorCode());
|
||||
}
|
||||
|
||||
@Test
|
||||
void createDbSnapshotThrowsForNonPostgres() {
|
||||
rdsService.createDbInstance("mydb", "mysql", "8.0",
|
||||
|
||||
Reference in new issue
Block a user