From d1fe27cb92f163637eec438e5e6f953efc84c0b2 Mon Sep 17 00:00:00 2001 From: Allen Sanborn Date: Mon, 12 Oct 2026 20:19:15 -0500 Subject: [PATCH] fix(mq): route DescribeSharedResources (#5356) * fix(mq): route DescribeSharedResources GET /v1/brokers/{broker-id}/shared-resources was unrouted and fell through to S3 (NoSuchBucket). Return an empty sharedResources list for an existing broker, NotFoundException for an unknown one. * docs(mq): say why DescribeSharedResources is always empty Floci does have resource shares (RAM); what keeps the list empty is that a share reaches a broker only through UpdateBroker's resourceShareArns, and Floci has no UpdateBroker. --- docs/services/amazonmq.md | 1 + .../services/amazonmq/AmazonMqController.java | 9 ++++++++ .../AmazonMqControllerIntegrationTest.java | 23 +++++++++++++++++++ 3 files changed, 33 insertions(+) diff --git a/docs/services/amazonmq.md b/docs/services/amazonmq.md index 5b23e34909..069e862b54 100644 --- a/docs/services/amazonmq.md +++ b/docs/services/amazonmq.md @@ -19,6 +19,7 @@ Only the **RabbitMQ** engine and the `SINGLE_INSTANCE` deployment mode are suppo | `ListBrokers` | List all emulated brokers | | `DeleteBroker` | Stops and removes the RabbitMQ container | | `RebootBroker` | Reboots the broker | +| `DescribeSharedResources` | Returns an empty `sharedResources` list for an existing broker (always empty, since Floci has no `UpdateBroker` to associate a resource share with the broker) | ### User management diff --git a/src/main/java/io/github/hectorvent/floci/services/amazonmq/AmazonMqController.java b/src/main/java/io/github/hectorvent/floci/services/amazonmq/AmazonMqController.java index 27c07cd3a9..4a4f9155b0 100644 --- a/src/main/java/io/github/hectorvent/floci/services/amazonmq/AmazonMqController.java +++ b/src/main/java/io/github/hectorvent/floci/services/amazonmq/AmazonMqController.java @@ -184,6 +184,15 @@ public class AmazonMqController { return Response.ok(body).build(); } + @GET + @Path("/v1/brokers/{broker-id}/shared-resources") + public Response describeSharedResources(@PathParam("broker-id") String brokerId) { + // Always empty: a resource share reaches a broker only through UpdateBroker's + // resourceShareArns, and Floci has no UpdateBroker to associate one with the broker. + service.describeBroker(brokerId); + return Response.ok(Map.of("sharedResources", List.of())).build(); + } + @DELETE @Path("/v1/brokers/{broker-id}/users/{username}") public Response deleteUser(@PathParam("broker-id") String brokerId, diff --git a/src/test/java/io/github/hectorvent/floci/services/amazonmq/AmazonMqControllerIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/amazonmq/AmazonMqControllerIntegrationTest.java index 3745e9b418..8493215e18 100644 --- a/src/test/java/io/github/hectorvent/floci/services/amazonmq/AmazonMqControllerIntegrationTest.java +++ b/src/test/java/io/github/hectorvent/floci/services/amazonmq/AmazonMqControllerIntegrationTest.java @@ -150,6 +150,29 @@ class AmazonMqControllerIntegrationTest { .statusCode(400); } + @Test + void describeSharedResourcesReturnsEmptyList() { + String brokerId = createRabbitBroker("it-shared"); + + given() + .when() + .get("/v1/brokers/{id}/shared-resources", brokerId) + .then() + .statusCode(200) + .body("sharedResources", equalTo(List.of())) + .body("$", not(hasKey("nextToken"))); + } + + @Test + void describeSharedResourcesUnknownBrokerIsNotFound() { + given() + .when() + .get("/v1/brokers/{id}/shared-resources", "b-does-not-exist") + .then() + .statusCode(404) + .body("__type", equalTo("NotFoundException")); + } + @Test void rejectsBrokerWithoutUser() { given()