mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
fix(rds): restore Terraform RDS and RabbitMQ compatibility (#1951)
* fix(rds): support dbi resource id filter * fix(mq): omit RabbitMQ users from broker response
This commit is contained in:
1 parent
a5daab6fb7
commit
ea1231b8b4
6 files changed
+75
-4
No files matched your search
+3
@@ -41,6 +41,9 @@ class AmazonMqControllerIntegrationTest {
|
||||
.body("engineType", equalTo("RABBITMQ"))
|
||||
.body("brokerState", equalTo("RUNNING"))
|
||||
.body("brokerInstances[0].endpoints[0]", startsWith("amqp://"))
|
||||
// AWS does not expose RabbitMQ users from DescribeBroker. Returning
|
||||
// them makes Terraform call the unsupported standalone User API.
|
||||
.body("users", nullValue())
|
||||
// internal bookkeeping is persisted but must never leak into the API
|
||||
.body("containerId", nullValue())
|
||||
.body("accountId", nullValue())
|
||||
|
||||
@@ -108,6 +108,24 @@ class RdsQueryHandlerTest {
|
||||
verify(service).listDbInstances("mydb");
|
||||
}
|
||||
|
||||
@Test
|
||||
void describeDbInstances_filterByDbiResourceId() {
|
||||
DbInstance instance = makeInstance("mydb");
|
||||
instance.setDbiResourceId("db-RESOURCE123");
|
||||
when(service.listDbInstancesByDbiResourceIds(List.of("db-RESOURCE123", "db-RESOURCE456")))
|
||||
.thenReturn(List.of(instance));
|
||||
|
||||
MultivaluedMap<String, String> p = params();
|
||||
p.add("Filters.Filter.1.Name", "dbi-resource-id");
|
||||
p.add("Filters.Filter.1.Values.Value.1", "db-RESOURCE123");
|
||||
p.add("Filters.Filter.1.Values.Value.2", "db-RESOURCE456");
|
||||
Response response = handler.handle("DescribeDBInstances", p);
|
||||
|
||||
verify(service).listDbInstancesByDbiResourceIds(List.of("db-RESOURCE123", "db-RESOURCE456"));
|
||||
String body = (String) response.getEntity();
|
||||
assertTrue(body.contains("<DBInstanceIdentifier>mydb</DBInstanceIdentifier>"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void describeDbInstances_directIdentifierTakesPriorityOverFilters() {
|
||||
when(service.listDbInstances(any())).thenReturn(List.of());
|
||||
|
||||
@@ -335,6 +335,21 @@ class RdsServiceTest {
|
||||
"arn:aws:rds:eu-west-1:123456789012:cluster:cluster1").isEmpty(), "cross-region ARN must not match");
|
||||
}
|
||||
|
||||
@Test
|
||||
void listDbInstancesByDbiResourceIdsUsesExactOrMatching() {
|
||||
DbInstance instance = rdsService.createDbInstance("mydb", "postgres", "13",
|
||||
"admin", "password", "dbname", "db.t3.micro",
|
||||
20, false, null, null, null, null, false);
|
||||
|
||||
Collection<DbInstance> result = rdsService.listDbInstancesByDbiResourceIds(
|
||||
List.of("db-missing", instance.getDbiResourceId()));
|
||||
|
||||
assertEquals(1, result.size());
|
||||
assertEquals("mydb", result.iterator().next().getDbInstanceIdentifier());
|
||||
assertTrue(rdsService.listDbInstancesByDbiResourceIds(
|
||||
List.of(instance.getDbiResourceId().toLowerCase())).isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
void modifyDbInstanceBlankPasswordDoesNotOverwriteExistingPassword() {
|
||||
rdsService.createDbInstance("mydb", "postgres", "13",
|
||||
|
||||
Reference in new issue
Block a user