mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
fix(lambda): default event source mapping BatchSize by source type (#5362)
CreateEventSourceMapping stored BatchSize 10 for every event source when the request omitted it. The Lambda model documents a per-source default: 10 for SQS and 100 for Kinesis, DynamoDB Streams, Amazon MSK, self-managed Apache Kafka, Amazon MQ and DocumentDB. SQS mappings keep 10; every other source now defaults to 100. updateEventSourceMapping_invalidLaterField_leavesBatchSizeAndEnabledUnchanged asserted the untouched Kafka mapping kept the old default of 10; it now expects 100. Fixes #4740
This commit is contained in:
1 parent
1082941bc2
commit
29319fbfb5
3 files changed
+42
-2
No files matched your search
@@ -1844,4 +1844,26 @@ class EsmIntegrationTest {
|
||||
given().delete(LAMBDA_BASE + "/event-source-mappings/" + uuid);
|
||||
}
|
||||
}
|
||||
@Test
|
||||
@Order(94)
|
||||
void sqsEventSourceMappingWithoutBatchSizeDefaultsTo10() {
|
||||
// Catches: the per-source BatchSize default also raising SQS mappings from 10 to 100
|
||||
String uuid = given()
|
||||
.contentType("application/json")
|
||||
.body("""
|
||||
{
|
||||
"FunctionName": "%s",
|
||||
"EventSourceArn": "%s"
|
||||
}
|
||||
""".formatted(FUNCTION_NAME, QUEUE_ARN))
|
||||
.when()
|
||||
.post(LAMBDA_BASE + "/event-source-mappings")
|
||||
.then()
|
||||
.statusCode(202)
|
||||
.body("BatchSize", equalTo(10))
|
||||
.extract()
|
||||
.path("UUID");
|
||||
|
||||
given().delete(LAMBDA_BASE + "/event-source-mappings/" + uuid).then().statusCode(202);
|
||||
}
|
||||
}
|
||||
@@ -1971,7 +1971,7 @@ class LambdaServiceTest {
|
||||
"FunctionResponseTypes", List.of("Bogus"))));
|
||||
|
||||
EventSourceMapping stored = service.getEventSourceMapping(esm.getUuid());
|
||||
assertEquals(10, stored.getBatchSize());
|
||||
assertEquals(100, stored.getBatchSize());
|
||||
assertTrue(stored.isEnabled());
|
||||
}
|
||||
|
||||
@@ -2536,4 +2536,17 @@ class LambdaServiceTest {
|
||||
assertEquals("ValidationException", error.getErrorCode());
|
||||
assertEquals("original", service.getAlias(REGION, "alias-description-fn", "live").getDescription());
|
||||
}
|
||||
|
||||
@Test
|
||||
void createEventSourceMapping_selfManagedKafkaWithoutBatchSize_defaultsTo100() {
|
||||
// Catches: every event source defaulting to BatchSize 10, where AWS uses 10 only for SQS
|
||||
service.createFunction(REGION, baseRequest("kafka-default-batch-fn"));
|
||||
|
||||
EventSourceMapping esm = service.createEventSourceMapping(REGION, Map.of(
|
||||
"FunctionName", "kafka-default-batch-fn",
|
||||
"Topics", List.of("my-topic"),
|
||||
"SelfManagedEventSource", Map.of("Endpoints", Map.of("KAFKA_BOOTSTRAP_SERVERS", List.of("localhost:9092")))));
|
||||
|
||||
assertEquals(100, esm.getBatchSize());
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user