mirror of
https://github.com/floci-io/floci.git
synced 2026-11-22 21:50:46 -05:00
fix(apigw-v2): populate pathParameters in Lambda proxy event for HTTP API integrations (#1067)
* fix(apigw-v2): populate pathParameters in Lambda proxy event for HTTP API integrations
buildV2ProxyEvent never called extractV2PathParams, so pathParameters was always
absent from the Lambda event payload. Frameworks that rely on it for routing (e.g.
the tRPC AWS Lambda adapter via ANY /{proxy+}) failed with path routing errors.
Wire extractV2PathParams into buildV2ProxyEvent after the queryStringParameters
block, mirroring how dispatchHttpProxyV2 already uses it. Also relax the method
visibility to package-private to allow the new unit tests to call it directly.
* test(ec2): scope Ec2NetworkInterfacePaginationTest to its own VPC
DescribeNetworkInterfaces was called without a filter, so the tests
counted ENIs created by other concurrently-running sdk-test-java tests
(e.g. sdk-test-instance from Ec2DescribeNetworkInterfacesTest), causing
intermittent failures when test ordering meant those ENIs existed at
assertion time.
Adds a vpc-id filter helper scoped to the VPC created in @BeforeAll so
each test only sees the 6 ENIs it owns.
This commit is contained in:
1 parent
9d1e24a582
commit
f8a2f2d5c4
3 files changed
+97
-23
No files matched your search
+12
-22
@@ -110,12 +110,17 @@ class Ec2NetworkInterfacePaginationTest {
|
||||
}
|
||||
}
|
||||
|
||||
private DescribeNetworkInterfacesRequest.Builder vpcFilter() {
|
||||
return DescribeNetworkInterfacesRequest.builder()
|
||||
.filters(Filter.builder().name("vpc-id").values(vpcId).build());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(1)
|
||||
@DisplayName("DescribeNetworkInterfaces without pagination returns all 6 ENIs")
|
||||
void describeNetworkInterfacesAll() {
|
||||
DescribeNetworkInterfacesResponse resp = ec2.describeNetworkInterfaces(
|
||||
DescribeNetworkInterfacesRequest.builder().build());
|
||||
vpcFilter().build());
|
||||
|
||||
assertThat(resp.networkInterfaces()).hasSize(6);
|
||||
assertThat(resp.nextToken()).isNull();
|
||||
@@ -126,9 +131,7 @@ class Ec2NetworkInterfacePaginationTest {
|
||||
@DisplayName("MaxResults=5 truncates first page and returns nextToken")
|
||||
void describeNetworkInterfacesFirstPage() {
|
||||
DescribeNetworkInterfacesResponse resp = ec2.describeNetworkInterfaces(
|
||||
DescribeNetworkInterfacesRequest.builder()
|
||||
.maxResults(5)
|
||||
.build());
|
||||
vpcFilter().maxResults(5).build());
|
||||
|
||||
assertThat(resp.networkInterfaces()).hasSize(5);
|
||||
assertThat(resp.nextToken()).isNotNull().isNotEmpty();
|
||||
@@ -140,17 +143,12 @@ class Ec2NetworkInterfacePaginationTest {
|
||||
void describeNetworkInterfacesContinuation() {
|
||||
// Page 1: get nextToken
|
||||
DescribeNetworkInterfacesResponse page1 = ec2.describeNetworkInterfaces(
|
||||
DescribeNetworkInterfacesRequest.builder()
|
||||
.maxResults(5)
|
||||
.build());
|
||||
vpcFilter().maxResults(5).build());
|
||||
assertThat(page1.nextToken()).isNotNull();
|
||||
|
||||
// Page 2: use nextToken
|
||||
DescribeNetworkInterfacesResponse page2 = ec2.describeNetworkInterfaces(
|
||||
DescribeNetworkInterfacesRequest.builder()
|
||||
.maxResults(5)
|
||||
.nextToken(page1.nextToken())
|
||||
.build());
|
||||
vpcFilter().maxResults(5).nextToken(page1.nextToken()).build());
|
||||
|
||||
assertThat(page2.networkInterfaces()).hasSize(1);
|
||||
assertThat(page2.nextToken()).isNull();
|
||||
@@ -175,25 +173,17 @@ class Ec2NetworkInterfacePaginationTest {
|
||||
void describeNetworkInterfacesTokenPastEnd() {
|
||||
// Get a valid token from first page
|
||||
DescribeNetworkInterfacesResponse page1 = ec2.describeNetworkInterfaces(
|
||||
DescribeNetworkInterfacesRequest.builder()
|
||||
.maxResults(5)
|
||||
.build());
|
||||
vpcFilter().maxResults(5).build());
|
||||
String token = page1.nextToken();
|
||||
|
||||
// Use it to get the last page
|
||||
DescribeNetworkInterfacesResponse page2 = ec2.describeNetworkInterfaces(
|
||||
DescribeNetworkInterfacesRequest.builder()
|
||||
.maxResults(5)
|
||||
.nextToken(token)
|
||||
.build());
|
||||
vpcFilter().maxResults(5).nextToken(token).build());
|
||||
|
||||
// Using the token from page2 (which is null since it's the last page)
|
||||
// would be invalid, but using a valid token again should still work
|
||||
DescribeNetworkInterfacesResponse repeat = ec2.describeNetworkInterfaces(
|
||||
DescribeNetworkInterfacesRequest.builder()
|
||||
.maxResults(5)
|
||||
.nextToken(token)
|
||||
.build());
|
||||
vpcFilter().maxResults(5).nextToken(token).build());
|
||||
|
||||
assertThat(repeat.networkInterfaces()).hasSize(1);
|
||||
assertThat(repeat.nextToken()).isNull();
|
||||
|
||||
Reference in new issue
Block a user