Skip to content

Commit 0c2af76

Browse files
committed
Add GraalVM support for E2E tests starting with metrics handler.
1 parent 08c9db8 commit 0c2af76

File tree

14 files changed

+493
-56
lines changed

14 files changed

+493
-56
lines changed

powertools-e2e-tests/handlers/metrics/pom.xml

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<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">
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
33
<modelVersion>4.0.0</modelVersion>
44

55
<parent>
@@ -21,6 +21,16 @@
2121
<groupId>com.amazonaws</groupId>
2222
<artifactId>aws-lambda-java-events</artifactId>
2323
</dependency>
24+
<dependency>
25+
<groupId>com.amazonaws</groupId>
26+
<artifactId>aws-lambda-java-runtime-interface-client</artifactId>
27+
<version>2.8.2</version>
28+
</dependency>
29+
<dependency>
30+
<groupId>com.amazonaws</groupId>
31+
<artifactId>aws-lambda-java-core</artifactId>
32+
<version>1.3.0</version>
33+
</dependency>
2434
<dependency>
2535
<groupId>org.aspectj</groupId>
2636
<artifactId>aspectjrt</artifactId>
@@ -57,4 +67,37 @@
5767
</plugin>
5868
</plugins>
5969
</build>
70+
71+
<profiles>
72+
<profile>
73+
<id>native-image</id>
74+
<build>
75+
<plugins>
76+
<plugin>
77+
<groupId>org.graalvm.buildtools</groupId>
78+
<artifactId>native-maven-plugin</artifactId>
79+
<version>0.10.1</version>
80+
<extensions>true</extensions>
81+
<executions>
82+
<execution>
83+
<id>build-native</id>
84+
<goals>
85+
<goal>build</goal>
86+
</goals>
87+
<phase>package</phase>
88+
</execution>
89+
</executions>
90+
<configuration>
91+
<imageName>handler</imageName>
92+
<mainClass>com.amazonaws.services.lambda.runtime.api.client.AWSLambda</mainClass>
93+
<buildArgs>
94+
<arg>--enable-url-protocols=http</arg>
95+
<arg>--add-opens java.base/java.util=ALL-UNNAMED</arg>
96+
</buildArgs>
97+
</configuration>
98+
</plugin>
99+
</plugins>
100+
</build>
101+
</profile>
102+
</profiles>
60103
</project>
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,61 @@
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+
}
61+
]
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+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[
2+
{
3+
"name": "software.amazon.lambda.powertools.e2e.Function",
4+
"allDeclaredConstructors": true,
5+
"allPublicConstructors": true,
6+
"allDeclaredMethods": true,
7+
"allPublicMethods": true,
8+
"allDeclaredClasses": true,
9+
"allPublicClasses": true
10+
},
11+
{
12+
"name": "software.amazon.lambda.powertools.e2e.Input",
13+
"allDeclaredConstructors": true,
14+
"allPublicConstructors": true,
15+
"allDeclaredMethods": true,
16+
"allPublicMethods": true,
17+
"allDeclaredClasses": true,
18+
"allPublicClasses": true
19+
}
20+
]

powertools-e2e-tests/pom.xml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,41 @@
234234
</plugins>
235235
</build>
236236
</profile>
237+
<profile>
238+
<id>e2e-graal</id>
239+
<build>
240+
<plugins>
241+
<plugin>
242+
<groupId>org.apache.maven.plugins</groupId>
243+
<artifactId>maven-failsafe-plugin</artifactId>
244+
<version>3.5.3</version>
245+
<executions>
246+
<execution>
247+
<goals>
248+
<goal>integration-test</goal>
249+
<goal>verify</goal>
250+
</goals>
251+
</execution>
252+
</executions>
253+
<configuration>
254+
<skipAfterFailureCount>1</skipAfterFailureCount>
255+
<includes>
256+
<include>**/MetricsE2ET.java</include>
257+
</includes>
258+
<excludes>
259+
<exclude>**/TracingE2ET.java</exclude>
260+
</excludes>
261+
<systemPropertyVariables>
262+
<!-- This will bundle the handlers/* using GraalVM into a native image and deploy
263+
them using the AL2023.provided runtime. The same E2E test output is expected for such
264+
deployments. -->
265+
<graalvm.enabled>true</graalvm.enabled>
266+
</systemPropertyVariables>
267+
</configuration>
268+
</plugin>
269+
</plugins>
270+
</build>
271+
</profile>
237272
</profiles>
238273

239274
</project>

0 commit comments

Comments
 (0)