fix(lambda): retain event source qualifiers at invocation (#6288)

Signed-off-by: Andre Kurait <akurait@amazon.com>
This commit is contained in:
Andre Kurait authored and GitHub committed 2026-10-22 20:55:44 -04:00
1 parent 2ae6d16936
commit 504e0dfde7
7 files changed
+29 -18

No files matched your search

@@ -409,14 +409,14 @@ class DynamoDbStreamsEventSourcePollerTest {
void versionQualifiedMappingInvokesThatVersion() {
stubTrimHorizon(List.of(ddbRecord("s1", "INSERT", "{\"status\":{\"S\":\"active\"}}")));
LambdaFunction version1 = stubVersion("1");
when(executorService.invoke(any(), any(byte[].class), eq(InvocationType.RequestResponse)))
when(executorService.invoke(any(), any(byte[].class), eq(InvocationType.RequestResponse), eq(0), eq("1")))
.thenReturn(new InvokeResult());
EventSourceMapping esm = filterEsm();
esm.setFunctionArn("arn:aws:lambda:us-east-1:" + ACCOUNT_ID + ":function:fn:1");
pollerWith(mock(EsmStore.class)).pollAndInvoke(esm);
verify(executorService, timeout(2000)).invoke(eq(version1), any(byte[].class), eq(InvocationType.RequestResponse));
verify(executorService, timeout(2000)).invoke(eq(version1), any(byte[].class), eq(InvocationType.RequestResponse), eq(0), eq("1"));
}
@Test
@@ -428,14 +428,14 @@ class DynamoDbStreamsEventSourcePollerTest {
alias.setFunctionName("fn");
alias.setFunctionVersion("2");
when(aliasStore.getForAccount(ACCOUNT_ID, "us-east-1", "fn", "live")).thenReturn(Optional.of(alias));
when(executorService.invoke(any(), any(byte[].class), eq(InvocationType.RequestResponse)))
when(executorService.invoke(any(), any(byte[].class), eq(InvocationType.RequestResponse), eq(0), eq("live")))
.thenReturn(new InvokeResult());
EventSourceMapping esm = filterEsm();
esm.setFunctionArn("arn:aws:lambda:us-east-1:" + ACCOUNT_ID + ":function:fn:live");
pollerWith(mock(EsmStore.class)).pollAndInvoke(esm);
verify(executorService, timeout(2000)).invoke(eq(version2), any(byte[].class), eq(InvocationType.RequestResponse));
verify(executorService, timeout(2000)).invoke(eq(version2), any(byte[].class), eq(InvocationType.RequestResponse), eq(0), eq("live"));
}
private LambdaFunction stubVersion(String version) {
@@ -168,13 +168,13 @@ class KinesisEventSourcePollerTest {
stubFunction();
LambdaFunction version1 = stubVersion("1");
stubStreamWith(List.of(record("s1", "p1", "{}")));
when(executorService.invoke(any(), any(), eq(InvocationType.RequestResponse))).thenReturn(new InvokeResult());
when(executorService.invoke(any(), any(), eq(InvocationType.RequestResponse), eq(0), eq("1"))).thenReturn(new InvokeResult());
EventSourceMapping esm = esm();
esm.setFunctionArn("arn:aws:lambda:" + REGION + ":" + ACCOUNT + ":function:fn:1");
poller.pollAndInvoke(esm);
verify(executorService, timeout(2000)).invoke(eq(version1), any(), eq(InvocationType.RequestResponse));
verify(executorService, timeout(2000)).invoke(eq(version1), any(), eq(InvocationType.RequestResponse), eq(0), eq("1"));
}
@Test
@@ -187,13 +187,13 @@ class KinesisEventSourcePollerTest {
alias.setFunctionVersion("2");
when(aliasStore.getForAccount(ACCOUNT, REGION, "fn", "live")).thenReturn(Optional.of(alias));
stubStreamWith(List.of(record("s1", "p1", "{}")));
when(executorService.invoke(any(), any(), eq(InvocationType.RequestResponse))).thenReturn(new InvokeResult());
when(executorService.invoke(any(), any(), eq(InvocationType.RequestResponse), eq(0), eq("live"))).thenReturn(new InvokeResult());
EventSourceMapping esm = esm();
esm.setFunctionArn("arn:aws:lambda:" + REGION + ":" + ACCOUNT + ":function:fn:live");
poller.pollAndInvoke(esm);
verify(executorService, timeout(2000)).invoke(eq(version2), any(), eq(InvocationType.RequestResponse));
verify(executorService, timeout(2000)).invoke(eq(version2), any(), eq(InvocationType.RequestResponse), eq(0), eq("live"));
}
private LambdaFunction stubVersion(String version) {
@@ -344,12 +344,12 @@ class SqsEventSourcePollerTest {
when(functionStore.getForAccount("000000000000", "us-east-1", "throwfn", "1"))
.thenReturn(Optional.of(version1));
stubReceive(esm, List.of(message("m1")));
when(executorService.invoke(any(LambdaFunction.class), any(byte[].class), eq(InvocationType.RequestResponse)))
when(executorService.invoke(any(LambdaFunction.class), any(byte[].class), eq(InvocationType.RequestResponse), eq(0), eq("1")))
.thenReturn(new InvokeResult());
poller.pollAndInvoke(esm);
verify(executorService, timeout(2000)).invoke(eq(version1), any(byte[].class), eq(InvocationType.RequestResponse));
verify(executorService, timeout(2000)).invoke(eq(version1), any(byte[].class), eq(InvocationType.RequestResponse), eq(0), eq("1"));
}
@Test
@@ -370,12 +370,12 @@ class SqsEventSourcePollerTest {
when(functionStore.getForAccount("000000000000", "us-east-1", "throwfn", "2"))
.thenReturn(Optional.of(version2));
stubReceive(esm, List.of(message("m1")));
when(executorService.invoke(any(LambdaFunction.class), any(byte[].class), eq(InvocationType.RequestResponse)))
when(executorService.invoke(any(LambdaFunction.class), any(byte[].class), eq(InvocationType.RequestResponse), eq(0), eq("live")))
.thenReturn(new InvokeResult());
poller.pollAndInvoke(esm);
verify(executorService, timeout(2000)).invoke(eq(version2), any(byte[].class), eq(InvocationType.RequestResponse));
verify(executorService, timeout(2000)).invoke(eq(version2), any(byte[].class), eq(InvocationType.RequestResponse), eq(0), eq("live"));
}
@Test