Skip to content

Commit 9bb882e

Browse files
committed
Fix E2E tests to return proper json for parsing in test suite.
1 parent 80496d7 commit 9bb882e

File tree

2 files changed

+15
-9
lines changed
  • powertools-e2e-tests

2 files changed

+15
-9
lines changed

powertools-e2e-tests/README.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
## End-to-end tests
2-
This module is internal and meant to be used for end-to-end (E2E) testing of Powertools for AWS Lambda (Java).
32

4-
__Prerequisites__:
5-
- An AWS account is needed as well as a local environment able to reach this account
6-
([credentials](https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/credentials.html)).
3+
This module is internal and meant to be used for end-to-end (E2E) testing of Powertools for AWS Lambda (Java).
4+
5+
**Prerequisites**:
6+
7+
- An AWS account is needed as well as a local environment able to reach this account
8+
([credentials](https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/credentials.html)).
79
- [Java 11+](https://docs.aws.amazon.com/corretto/latest/corretto-11-ug/downloads-list.html)
8-
- [Docker](https://docs.docker.com/engine/install/)
10+
- [Docker](https://docs.docker.com/engine/install/) (or [Finch](https://github.com/runfinch/finch) — if using Finch, set `export CDK_DOCKER=finch` before running tests)
911

1012
To execute the E2E tests, use the following command: `export JAVA_VERSION=11 && mvn clean verify -Pe2e`
1113

1214
### Under the hood
15+
1316
This module leverages the following components:
17+
1418
- AWS CDK to define the infrastructure and synthesize a CloudFormation template and the assets (lambda function packages)
1519
- The AWS S3 SDK to push the assets on S3
16-
- The AWS CloudFormation SDK to deploy the template
20+
- The AWS CloudFormation SDK to deploy the template

powertools-e2e-tests/handlers/lambda-metadata/src/main/java/software/amazon/lambda/powertools/e2e/Function.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,17 @@
1414

1515
package software.amazon.lambda.powertools.e2e;
1616

17+
import java.util.Map;
18+
1719
import com.amazonaws.services.lambda.runtime.Context;
1820
import com.amazonaws.services.lambda.runtime.RequestHandler;
1921
import software.amazon.lambda.powertools.metadata.LambdaMetadata;
2022
import software.amazon.lambda.powertools.metadata.LambdaMetadataClient;
2123

22-
public class Function implements RequestHandler<Object, String> {
24+
public class Function implements RequestHandler<Object, Map<String, String>> {
2325

24-
public String handleRequest(Object input, Context context) {
26+
public Map<String, String> handleRequest(Object input, Context context) {
2527
LambdaMetadata metadata = LambdaMetadataClient.get();
26-
return "{\"availabilityZoneId\": \"" + metadata.getAvailabilityZoneId() + "\"}";
28+
return Map.of("availabilityZoneId", metadata.getAvailabilityZoneId());
2729
}
2830
}

0 commit comments

Comments
 (0)