Skip to content

armgit / floci

Public Imported from GitHub
0

Light, fluffy, and always free - The AWS Local Emulator alternative

fix(appconfig): use capital "Tags" body key matching AWS SDK wire format (#704)

Kenshin Okinaka7fa2a28c627b
diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/AppConfigTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/AppConfigTest.java
index b26a18fbb2..b99df3defc 100644
--- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/AppConfigTest.java
+++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/AppConfigTest.java
@@ -266,4 +266,44 @@ class AppConfigTest {
// The RestAssured internal test sees "" (raw HTTP header value).
assertThat(response.versionLabel()).isNull();
}
+
+ @Test
+ @Order(50)
+ @DisplayName("TagResource / ListTagsForResource - SDK round-trip")
+ void tagAndListViaSdk() {
+ // Reproducer for the wire-format mismatch that previously made AWS SDK callers
+ // silently get an empty tag set: SDK serializes as {"Tags": {...}} (capital),
+ // floci must accept and echo back that exact shape.
+ String tagAppId = appConfig.createApplication(CreateApplicationRequest.builder()
+ .name("tag-roundtrip-app")
+ .build()).id();
+ String arn = "arn:aws:appconfig:us-east-1:000000000000:application/" + tagAppId;
+ try {
+ appConfig.tagResource(TagResourceRequest.builder()
+ .resourceArn(arn)
+ .tags(java.util.Map.of("env", "prod", "owner", "Alice"))
+ .build());
+
+ ListTagsForResourceResponse listed = appConfig.listTagsForResource(
+ ListTagsForResourceRequest.builder().resourceArn(arn).build());
+ assertThat(listed.tags())
+ .containsEntry("env", "prod")
+ .containsEntry("owner", "Alice");
+
+ appConfig.untagResource(UntagResourceRequest.builder()
+ .resourceArn(arn)
+ .tagKeys("env")
+ .build());
+
+ assertThat(appConfig.listTagsForResource(
+ ListTagsForResourceRequest.builder().resourceArn(arn).build()).tags())
+ .doesNotContainKey("env")
+ .containsEntry("owner", "Alice");
+ } finally {
+ try {
+ appConfig.deleteApplication(DeleteApplicationRequest.builder()
+ .applicationId(tagAppId).build());
+ } catch (Exception ignored) {}
+ }
+ }
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/appconfig/AppConfigTagHandler.java b/src/main/java/io/github/hectorvent/floci/services/appconfig/AppConfigTagHandler.java
index fd689f7ae4..cbb32a82b3 100644
--- a/src/main/java/io/github/hectorvent/floci/services/appconfig/AppConfigTagHandler.java
+++ b/src/main/java/io/github/hectorvent/floci/services/appconfig/AppConfigTagHandler.java
@@ -36,6 +36,11 @@ public class AppConfigTagHandler implements TagHandler {
return "appconfig";
}
+ @Override
+ public String tagsBodyKey() {
+ return "Tags";
+ }
+
@Override
public Map<String, String> listTags(String region, String arn) {
ResourceRef ref = parseArn(arn);
diff --git a/src/test/java/io/github/hectorvent/floci/services/appconfig/AppConfigIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/appconfig/AppConfigIntegrationTest.java
index 1fce3ddc7a..d653716e90 100644
--- a/src/test/java/io/github/hectorvent/floci/services/appconfig/AppConfigIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/appconfig/AppConfigIntegrationTest.java
@@ -233,7 +233,7 @@ class AppConfigIntegrationTest {
.when().get("/tags/" + arn)
.then()
.statusCode(200)
- .body("tags", anEmptyMap());
+ .body("Tags", anEmptyMap());
}
@Test @Order(15)
@@ -241,7 +241,7 @@ class AppConfigIntegrationTest {
String arn = "arn:aws:appconfig:us-east-1:000000000000:application/" + appId;
given()
.contentType(ContentType.JSON)
- .body("{\"tags\": {\"env\": \"local\", \"team\": \"platform\"}}")
+ .body("{\"Tags\": {\"env\": \"local\", \"team\": \"platform\"}}")
.when().post("/tags/" + arn)
.then()
.statusCode(204);
@@ -254,8 +254,8 @@ class AppConfigIntegrationTest {
.when().get("/tags/" + arn)
.then()
.statusCode(200)
- .body("tags.env", equalTo("local"))
- .body("tags.team", equalTo("platform"));
+ .body("Tags.env", equalTo("local"))
+ .body("Tags.team", equalTo("platform"));
}
@Test @Order(17)
@@ -274,8 +274,8 @@ class AppConfigIntegrationTest {
.when().get("/tags/" + arn)
.then()
.statusCode(200)
- .body("tags", not(hasKey("env")))
- .body("tags.team", equalTo("platform"));
+ .body("Tags", not(hasKey("env")))
+ .body("Tags.team", equalTo("platform"));
}
// ──────────────────────────── Tags on non-application resources (no-op) ────────────────────────────
@@ -287,7 +287,7 @@ class AppConfigIntegrationTest {
.when().get("/tags/" + arn)
.then()
.statusCode(200)
- .body("tags", anEmptyMap());
+ .body("Tags", anEmptyMap());
}
@Test @Order(20)
@@ -297,7 +297,7 @@ class AppConfigIntegrationTest {
.when().get("/tags/" + arn)
.then()
.statusCode(200)
- .body("tags", anEmptyMap());
+ .body("Tags", anEmptyMap());
}
@Test @Order(21)