mirror of
https://github.com/floci-io/floci.git
synced 2026-11-22 21:50:46 -05:00
fix(lambda): apply Architectures on UpdateFunctionCode (#2907)
This commit is contained in:
1 parent
047db09d54
commit
9b582b309a
2 files changed
+31
No files matched your search
@@ -533,6 +533,15 @@ public class LambdaService implements ResourceProvider {
|
||||
}
|
||||
}
|
||||
|
||||
if (request.containsKey("Architectures")) {
|
||||
@SuppressWarnings("unchecked")
|
||||
List<String> archs = request.get("Architectures") instanceof List
|
||||
? (List<String>) request.get("Architectures") : null;
|
||||
if (archs != null && !archs.isEmpty()) {
|
||||
fn.setArchitectures(new ArrayList<>(archs));
|
||||
}
|
||||
}
|
||||
|
||||
fn.setLastModified(System.currentTimeMillis());
|
||||
fn.setRevisionId(UUID.randomUUID().toString());
|
||||
|
||||
|
||||
@@ -579,6 +579,28 @@ class LambdaServiceTest {
|
||||
assertNotEquals(originalRevision, updated.getRevisionId());
|
||||
}
|
||||
|
||||
@Test
|
||||
void updateFunctionCodeAppliesArchitectures() {
|
||||
Map<String, Object> req = baseRequest("arch-fn");
|
||||
req.put("Architectures", List.of("arm64"));
|
||||
service.createFunction(REGION, req);
|
||||
|
||||
LambdaFunction updated = service.updateFunctionCode(REGION, "arch-fn",
|
||||
Map.of("Architectures", List.of("x86_64")));
|
||||
assertEquals(List.of("x86_64"), updated.getArchitectures());
|
||||
assertEquals(List.of("x86_64"), service.getFunction(REGION, "arch-fn").getArchitectures());
|
||||
}
|
||||
|
||||
@Test
|
||||
void updateFunctionCodeWithoutArchitecturesKeepsExisting() {
|
||||
Map<String, Object> req = baseRequest("arch-keep-fn");
|
||||
req.put("Architectures", List.of("arm64"));
|
||||
service.createFunction(REGION, req);
|
||||
|
||||
LambdaFunction updated = service.updateFunctionCode(REGION, "arch-keep-fn", Map.of());
|
||||
assertEquals(List.of("arm64"), updated.getArchitectures());
|
||||
}
|
||||
|
||||
@Test
|
||||
void rehydrateConcurrency_restoresReservedFromStore() {
|
||||
// Simulate a persisted state: functions already live in the store
|
||||
|
||||
Reference in new issue
Block a user