mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
fix(lambdaweb): do not clean up the revision a LatestRevision endpoint leaves (#6565)
AWS deletes it only when the next revision turns Active.
This commit is contained in:
1 parent
a69b52d99f
commit
c7b3d04e5b
3 files changed
+28
-2
No files matched your search
@@ -1013,6 +1013,31 @@ class LambdaWebServiceTest {
|
||||
assertTrue(Files.exists(code.file(ACCOUNT_ID, REGION, "app", active.get(2))));
|
||||
}
|
||||
|
||||
@Test
|
||||
void theRevisionALatestRevisionEndpointLeavesStaysUntilTheNextActiveOne() {
|
||||
S3Service s3 = mock(S3Service.class);
|
||||
LambdaWebService service = service(new MemoryStorageFactory(), "http://localhost:4566", s3);
|
||||
byte[] zip = LambdaWebZips.indexJs("");
|
||||
when(s3.openObject("code", "app.zip", null)).thenAnswer(invocation -> object(zip));
|
||||
String first = service.createFunction(REGION, createRequest("app")).revisions.keySet().iterator().next();
|
||||
when(s3.openObject("code", "app.zip", null)).thenAnswer(invocation -> object(NOT_A_ZIP));
|
||||
String failed = service.createRevision(REGION, "app", revisionConfig(30)).revisionId;
|
||||
for (int i = 0; i < 48; i++) {
|
||||
service.createRevision(REGION, "app", revisionConfig(30));
|
||||
}
|
||||
when(s3.openObject("code", "app.zip", null)).thenAnswer(invocation -> object(zip));
|
||||
|
||||
String second = service.createRevision(REGION, "app", revisionConfig(30)).revisionId;
|
||||
Set<String> kept = service.getFunction(REGION, "app").revisions.keySet();
|
||||
assertTrue(kept.contains(first));
|
||||
assertFalse(kept.contains(failed));
|
||||
|
||||
service.createRevision(REGION, "app", revisionConfig(30));
|
||||
kept = service.getFunction(REGION, "app").revisions.keySet();
|
||||
assertFalse(kept.contains(first));
|
||||
assertTrue(kept.contains(second));
|
||||
}
|
||||
|
||||
private ObjectNode stateFilter(String state) {
|
||||
ObjectNode request = mapper.createObjectNode();
|
||||
request.putArray("filters").addObject().put("name", "state").putArray("values").add(state);
|
||||
|
||||
Reference in new issue
Block a user