Light, fluffy, and always free - The AWS Local Emulator alternative
fix(cloudformation): persist FunctionResponseTypes on Lambda::EventSourceMapping (#2964)
Olamide Kosile9e2c03158d56
diff --git a/src/main/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationResourceProvisioner.java b/src/main/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationResourceProvisioner.javaindex 6e96b236de..f157693d98 100644--- a/src/main/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationResourceProvisioner.java+++ b/src/main/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationResourceProvisioner.java@@ -4117,6 +4117,11 @@ public class CloudFormationResourceProvisioner {}}+ List<String> functionResponseTypes = resolveStringList(props, "FunctionResponseTypes", engine);+ if (!functionResponseTypes.isEmpty()) {+ req.put("FunctionResponseTypes", functionResponseTypes);+ }+var esm = lambdaService.createEventSourceMapping(region, req);r.setPhysicalId(esm.getUuid());r.getAttributes().put("Id", esm.getUuid());diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationIntegrationTest.javaindex cff7ecced7..a1c0734c0e 100644--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationIntegrationTest.java+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationIntegrationTest.java@@ -4403,7 +4403,8 @@ class CloudFormationIntegrationTest {"FunctionName": { "Ref": "MyFunction" },"EventSourceArn": { "Fn::GetAtt": ["MyQueue", "Arn"] },"Enabled": true,- "BatchSize": 5+ "BatchSize": 5,+ "FunctionResponseTypes": ["ReportBatchItemFailures"]}}}@@ -4457,6 +4458,15 @@ class CloudFormationIntegrationTest {JsonNode esmList = OBJECT_MAPPER.readTree(esmJson);String esmUuid = esmList.path("EventSourceMappings").get(0).path("UUID").asText();+ // github.com/floci-io/floci/issues/2848: the CloudFormation path never read+ // FunctionResponseTypes, so a CFN-provisioned mapping always came back with an empty+ // list even though the template declared it and the direct CreateEventSourceMapping API+ // path already honored it.+ JsonNode responseTypes = esmList.path("EventSourceMappings").get(0).path("FunctionResponseTypes");+ assertTrue(responseTypes.isArray() && responseTypes.size() == 1+ && "ReportBatchItemFailures".equals(responseTypes.get(0).asText()),+ "expected FunctionResponseTypes to carry through from the template but was: " + responseTypes);+// 5. Delete stack and verify ESM is gonegiven().contentType("application/x-www-form-urlencoded")