Skip to content

Commit 4b1426b

Browse files
committed
Add E2E tests.
1 parent d327bff commit 4b1426b

15 files changed

Lines changed: 370 additions & 0 deletions

File tree

.github/workflows/check-e2e.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ on:
3131
- 'powertools-tracing/**'
3232
- 'powertools-tracing/**'
3333
- 'powertools-validation/**'
34+
- 'powertools-lambda-metadata/**'
3435
- 'pom.xml'
3536

3637
name: E2E Tests
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
5+
<parent>
6+
<groupId>software.amazon.lambda</groupId>
7+
<artifactId>e2e-test-handlers-parent</artifactId>
8+
<version>2.9.0</version>
9+
</parent>
10+
11+
<artifactId>e2e-test-handler-lambda-metadata</artifactId>
12+
<packaging>jar</packaging>
13+
<name>E2E test handler – Lambda Metadata</name>
14+
15+
<dependencies>
16+
<dependency>
17+
<groupId>software.amazon.lambda</groupId>
18+
<artifactId>powertools-lambda-metadata</artifactId>
19+
</dependency>
20+
<dependency>
21+
<groupId>com.amazonaws</groupId>
22+
<artifactId>aws-lambda-java-runtime-interface-client</artifactId>
23+
</dependency>
24+
<dependency>
25+
<groupId>com.amazonaws</groupId>
26+
<artifactId>aws-lambda-java-core</artifactId>
27+
</dependency>
28+
</dependencies>
29+
30+
<build>
31+
<plugins>
32+
<plugin>
33+
<groupId>org.apache.maven.plugins</groupId>
34+
<artifactId>maven-compiler-plugin</artifactId>
35+
</plugin>
36+
<plugin>
37+
<groupId>org.apache.maven.plugins</groupId>
38+
<artifactId>maven-shade-plugin</artifactId>
39+
</plugin>
40+
</plugins>
41+
</build>
42+
43+
<profiles>
44+
<profile>
45+
<id>native-image</id>
46+
<build>
47+
<plugins>
48+
<plugin>
49+
<groupId>org.graalvm.buildtools</groupId>
50+
<artifactId>native-maven-plugin</artifactId>
51+
</plugin>
52+
</plugins>
53+
</build>
54+
</profile>
55+
</profiles>
56+
</project>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
* Copyright 2023 Amazon.com, Inc. or its affiliates.
3+
* Licensed under the Apache License, Version 2.0 (the
4+
* "License"); you may not use this file except in compliance
5+
* with the License. You may obtain a copy of the License at
6+
* http://www.apache.org/licenses/LICENSE-2.0
7+
* Unless required by applicable law or agreed to in writing, software
8+
* distributed under the License is distributed on an "AS IS" BASIS,
9+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
* See the License for the specific language governing permissions and
11+
* limitations under the License.
12+
*
13+
*/
14+
15+
package software.amazon.lambda.powertools.e2e;
16+
17+
import com.amazonaws.services.lambda.runtime.Context;
18+
import com.amazonaws.services.lambda.runtime.RequestHandler;
19+
import software.amazon.lambda.powertools.metadata.LambdaMetadata;
20+
import software.amazon.lambda.powertools.metadata.LambdaMetadataClient;
21+
22+
public class Function implements RequestHandler<Object, String> {
23+
24+
public String handleRequest(Object input, Context context) {
25+
LambdaMetadata metadata = LambdaMetadataClient.get();
26+
return "{\"availabilityZoneId\": \"" + metadata.getAvailabilityZoneId() + "\"}";
27+
}
28+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[
2+
{
3+
"name":"com.amazonaws.services.lambda.runtime.LambdaRuntime",
4+
"methods":[{"name":"<init>","parameterTypes":[] }],
5+
"fields":[{"name":"logger"}],
6+
"allPublicMethods":true
7+
},
8+
{
9+
"name":"com.amazonaws.services.lambda.runtime.LambdaRuntimeInternal",
10+
"methods":[{"name":"<init>","parameterTypes":[] }],
11+
"allPublicMethods":true
12+
}
13+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
[
2+
{
3+
"name": "com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent",
4+
"allDeclaredFields": true,
5+
"allDeclaredMethods": true,
6+
"allDeclaredConstructors": true
7+
},
8+
{
9+
"name": "com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent$ProxyRequestContext",
10+
"allDeclaredFields": true,
11+
"allDeclaredMethods": true,
12+
"allDeclaredConstructors": true
13+
},
14+
{
15+
"name": "com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent$RequestIdentity",
16+
"allDeclaredFields": true,
17+
"allDeclaredMethods": true,
18+
"allDeclaredConstructors": true
19+
},
20+
{
21+
"name": "com.amazonaws.services.lambda.runtime.events.APIGatewayProxyResponseEvent",
22+
"allDeclaredFields": true,
23+
"allDeclaredMethods": true,
24+
"allDeclaredConstructors": true
25+
},
26+
{
27+
"name": "com.amazonaws.services.lambda.runtime.events.APIGatewayProxyResponseEvent",
28+
"allDeclaredConstructors": true,
29+
"allPublicConstructors": true,
30+
"allDeclaredMethods": true,
31+
"allPublicMethods": true,
32+
"allDeclaredClasses": true,
33+
"allPublicClasses": true
34+
}
35+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[
2+
{
3+
"name":"com.amazonaws.services.lambda.runtime.api.client.runtimeapi.LambdaRuntimeClientException",
4+
"methods":[{"name":"<init>","parameterTypes":["java.lang.String","int"] }]
5+
},
6+
{
7+
"name":"com.amazonaws.services.lambda.runtime.api.client.runtimeapi.dto.InvocationRequest",
8+
"fields":[{"name":"id"}, {"name":"invokedFunctionArn"}, {"name":"deadlineTimeInMs"}, {"name":"xrayTraceId"}, {"name":"clientContext"}, {"name":"cognitoIdentity"}, {"name": "tenantId"}, {"name":"content"}],
9+
"allPublicMethods":true
10+
}
11+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Args = --initialize-at-build-time=jdk.xml.internal.SecuritySupport
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
[
2+
{
3+
"name": "com.amazonaws.lambda.thirdparty.com.fasterxml.jackson.databind.deser.Deserializers[]"
4+
},
5+
{
6+
"name": "com.amazonaws.lambda.thirdparty.com.fasterxml.jackson.databind.ext.Java7SupportImpl",
7+
"methods": [{ "name": "<init>", "parameterTypes": [] }]
8+
},
9+
{
10+
"name": "com.amazonaws.services.lambda.runtime.LambdaRuntime",
11+
"fields": [{ "name": "logger" }]
12+
},
13+
{
14+
"name": "com.amazonaws.services.lambda.runtime.logging.LogLevel",
15+
"allDeclaredConstructors": true,
16+
"allPublicConstructors": true,
17+
"allDeclaredMethods": true,
18+
"allPublicMethods": true,
19+
"allDeclaredFields": true,
20+
"allPublicFields": true
21+
},
22+
{
23+
"name": "com.amazonaws.services.lambda.runtime.logging.LogFormat",
24+
"allDeclaredConstructors": true,
25+
"allPublicConstructors": true,
26+
"allDeclaredMethods": true,
27+
"allPublicMethods": true,
28+
"allDeclaredFields": true,
29+
"allPublicFields": true
30+
},
31+
{
32+
"name": "java.lang.Void",
33+
"methods": [{ "name": "<init>", "parameterTypes": [] }]
34+
},
35+
{
36+
"name": "java.util.Collections$UnmodifiableMap",
37+
"fields": [{ "name": "m" }]
38+
},
39+
{
40+
"name": "jdk.internal.module.IllegalAccessLogger",
41+
"fields": [{ "name": "logger" }]
42+
},
43+
{
44+
"name": "sun.misc.Unsafe",
45+
"fields": [{ "name": "theUnsafe" }]
46+
},
47+
{
48+
"name": "com.amazonaws.services.lambda.runtime.api.client.runtimeapi.dto.InvocationRequest",
49+
"fields": [
50+
{ "name": "id" },
51+
{ "name": "invokedFunctionArn" },
52+
{ "name": "deadlineTimeInMs" },
53+
{ "name": "xrayTraceId" },
54+
{ "name": "clientContext" },
55+
{ "name": "cognitoIdentity" },
56+
{ "name": "tenantId" },
57+
{ "name": "content" }
58+
],
59+
"allPublicMethods": true,
60+
"unsafeAllocated": true
61+
}
62+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"resources": {
3+
"includes": [
4+
{
5+
"pattern": "\\Qjni/libaws-lambda-jni.linux-aarch_64.so\\E"
6+
},
7+
{
8+
"pattern": "\\Qjni/libaws-lambda-jni.linux-x86_64.so\\E"
9+
},
10+
{
11+
"pattern": "\\Qjni/libaws-lambda-jni.linux_musl-aarch_64.so\\E"
12+
},
13+
{
14+
"pattern": "\\Qjni/libaws-lambda-jni.linux_musl-x86_64.so\\E"
15+
}
16+
]
17+
},
18+
"bundles": []
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
[
2+
{
3+
"name": "com.amazonaws.lambda.thirdparty.com.fasterxml.jackson.databind.deser.Deserializers[]"
4+
},
5+
{
6+
"name": "com.amazonaws.lambda.thirdparty.com.fasterxml.jackson.databind.ext.Java7HandlersImpl",
7+
"methods": [{ "name": "<init>", "parameterTypes": [] }]
8+
},
9+
{
10+
"name": "com.amazonaws.lambda.thirdparty.com.fasterxml.jackson.databind.ext.Java7SupportImpl",
11+
"methods": [{ "name": "<init>", "parameterTypes": [] }]
12+
},
13+
{
14+
"name": "com.amazonaws.lambda.thirdparty.com.fasterxml.jackson.databind.ser.Serializers[]"
15+
},
16+
{
17+
"name": "org.joda.time.DateTime",
18+
"allDeclaredConstructors": true,
19+
"allPublicConstructors": true,
20+
"allDeclaredMethods": true,
21+
"allPublicMethods": true,
22+
"allDeclaredClasses": true,
23+
"allPublicClasses": true
24+
}
25+
]

0 commit comments

Comments
 (0)