fix(lambda): answer DeleteFunction of a durable function with 202 (#8271)

DeleteFunction answered 204 for every function. AWS answers 202 with {}
when it deletes a durable function or a published version of one, and
Floci now does the same. A plain function and a missing version still
answer 204.
This commit is contained in:
TATSUNO “Taz” Yasuhiro authored and GitHub committed 2026-11-14 01:10:32 -04:00
1 parent cb03bc373b
commit ff5b6df114
5 files changed
+83 -8

No files matched your search

@@ -253,6 +253,55 @@ class LambdaDurableConfigIntegrationTest {
.body("$", not(hasKey("DurableConfig")));
}
@Test
void deleteFunctionAnswers202ForADurableFunctionAndItsExistingVersion() {
createDurableFunction("durable-delete-fn", "{\"ExecutionTimeout\": 3600}").statusCode(201);
given()
.contentType("application/json")
.body("{}")
.when()
.post(BASE_PATH + "/functions/durable-delete-fn/versions")
.then()
.statusCode(201);
given()
.when()
.delete(BASE_PATH + "/functions/durable-delete-fn?Qualifier=5")
.then()
.statusCode(204)
.body(equalTo(""));
given()
.when()
.delete(BASE_PATH + "/functions/durable-delete-fn?Qualifier=1")
.then()
.statusCode(202)
.contentType("application/json")
.body(equalTo("{}"));
given()
.when()
.delete(BASE_PATH + "/functions/durable-delete-fn")
.then()
.statusCode(202)
.contentType("application/json")
.body(equalTo("{}"));
getConfiguration("durable-delete-fn").statusCode(404);
}
@Test
void deleteFunctionAnswers204ForAPlainFunction() {
createFunction("plain-delete-fn", "").statusCode(201);
given()
.when()
.delete(BASE_PATH + "/functions/plain-delete-fn")
.then()
.statusCode(204)
.body(equalTo(""));
}
private static ValidatableResponse updateDurableConfig(String name, String durableConfig) {
return updateConfiguration(name, "{\"DurableConfig\": " + durableConfig + "}");
}
@@ -645,6 +645,22 @@ class LambdaServiceTest {
assertThrows(AwsException.class, () -> service.getFunction(REGION, "del-fn"));
}
@Test
void deleteFunctionReportsWhetherADurableFunctionOrItsVersionWasDeleted() {
Map<String, Object> durable = baseRequest("del-durable-fn");
durable.put("DurableConfig", Map.of("ExecutionTimeout", 3600));
service.createFunction(REGION, durable);
service.publishVersion(REGION, "del-durable-fn", null);
service.createFunction(REGION, baseRequest("del-plain-fn"));
service.publishVersion(REGION, "del-plain-fn", null);
assertFalse(service.deleteFunction(REGION, "del-durable-fn", "5"));
assertTrue(service.deleteFunction(REGION, "del-durable-fn", "1"));
assertTrue(service.deleteFunction(REGION, "del-durable-fn", null));
assertFalse(service.deleteFunction(REGION, "del-plain-fn", "1"));
assertFalse(service.deleteFunction(REGION, "del-plain-fn", null));
}
@Test
void deleteFunctionThrows404WhenNotFound() {
AwsException ex = assertThrows(AwsException.class,