Skip to content

Commit 93cb12f

Browse files
committed
maven setup for e2e tests
- rename to avoid execution during test phase - use a profile to execute them on demand only
1 parent f680d06 commit 93cb12f

File tree

6 files changed

+28
-29
lines changed

6 files changed

+28
-29
lines changed

powertools-e2e-tests/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
## End-to-end tests
2+
This module is internal and meant to be used for end-to-end (E2E) testing of Lambda Powertools for Java.
3+
4+
__Prerequisites__: an AWS account is needed as well as a local environment able to reach this account
5+
([credentials](https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/credentials.html)).
6+
7+
To execute the E2E tests, use the following command: `mvn clean verify -Pe2e`
8+
9+
### Under the hood
10+
This module leverages the following components:
11+
- AWS CDK to define the infrastructure and synthesize a CloudFormation template and the assets (lambda function packages)
12+
- The AWS S3 SDK to push the assets on S3
13+
- The AWS CloudFormation SDK to deploy the template

powertools-e2e-tests/pom.xml

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -144,28 +144,9 @@
144144

145145
<profiles>
146146
<profile>
147-
<id>it</id>
147+
<id>e2e</id>
148148
<build>
149149
<plugins>
150-
<plugin>
151-
<groupId>org.codehaus.mojo</groupId>
152-
<artifactId>build-helper-maven-plugin</artifactId>
153-
<version>3.3.0</version>
154-
<executions>
155-
<execution>
156-
<id>add-test-source</id>
157-
<phase>process-resources</phase>
158-
<goals>
159-
<goal>add-test-source</goal>
160-
</goals>
161-
<configuration>
162-
<sources>
163-
<source>src/it/java</source>
164-
</sources>
165-
</configuration>
166-
</execution>
167-
</executions>
168-
</plugin>
169150
<plugin>
170151
<groupId>org.apache.maven.plugins</groupId>
171152
<artifactId>maven-failsafe-plugin</artifactId>
@@ -178,6 +159,11 @@
178159
</goals>
179160
</execution>
180161
</executions>
162+
<configuration>
163+
<includes>
164+
<include>**/*E2ET.java</include>
165+
</includes>
166+
</configuration>
181167
</plugin>
182168
</plugins>
183169
</build>

powertools-e2e-tests/src/test/java/software/amazon/lambda/powertools/IdempotencyE2ETest.java renamed to powertools-e2e-tests/src/test/java/software/amazon/lambda/powertools/IdempotencyE2ET.java

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

1515
import static software.amazon.lambda.powertools.testutils.lambda.LambdaInvoker.invokeFunction;
1616

17-
public class IdempotencyE2ETest {
17+
public class IdempotencyE2ET {
1818
private static Infrastructure infrastructure;
1919
private static String functionName;
2020

2121
@BeforeAll
2222
@Timeout(value = 5, unit = TimeUnit.MINUTES)
2323
public static void setup() {
2424
infrastructure = Infrastructure.builder()
25-
.testName(IdempotencyE2ETest.class.getSimpleName())
25+
.testName(IdempotencyE2ET.class.getSimpleName())
2626
.pathToFunction("idempotency")
2727
.idempotencyTable("idempo")
2828
.environmentVariables(new HashMap<>() {{

powertools-e2e-tests/src/test/java/software/amazon/lambda/powertools/LoggingE2ETest.java renamed to powertools-e2e-tests/src/test/java/software/amazon/lambda/powertools/LoggingE2ET.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import static software.amazon.lambda.powertools.testutils.lambda.LambdaInvoker.invokeFunction;
1919
import static software.amazon.lambda.powertools.testutils.logging.InvocationLogs.Level.INFO;
2020

21-
public class LoggingE2ETest {
21+
public class LoggingE2ET {
2222

2323
private static final ObjectMapper objectMapper = new ObjectMapper();
2424

@@ -29,11 +29,11 @@ public class LoggingE2ETest {
2929
@Timeout(value = 5, unit = TimeUnit.MINUTES)
3030
public static void setup() {
3131
infrastructure = Infrastructure.builder()
32-
.testName(LoggingE2ETest.class.getSimpleName())
32+
.testName(LoggingE2ET.class.getSimpleName())
3333
.pathToFunction("logging")
3434
.environmentVariables(new HashMap<>() {{
3535
put("POWERTOOLS_LOG_LEVEL", "INFO");
36-
put("POWERTOOLS_SERVICE_NAME", LoggingE2ETest.class.getSimpleName());
36+
put("POWERTOOLS_SERVICE_NAME", LoggingE2ET.class.getSimpleName());
3737
}}
3838
)
3939
.build();

powertools-e2e-tests/src/test/java/software/amazon/lambda/powertools/MetricsE2ETest.java renamed to powertools-e2e-tests/src/test/java/software/amazon/lambda/powertools/MetricsE2ET.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import static org.assertj.core.api.Assertions.assertThat;
1818
import static software.amazon.lambda.powertools.testutils.lambda.LambdaInvoker.invokeFunction;
1919

20-
public class MetricsE2ETest {
20+
public class MetricsE2ET {
2121
private static final String namespace = "MetricsE2ENamespace_"+UUID.randomUUID();
2222
private static final String service = "MetricsE2EService_"+UUID.randomUUID();
2323
private static Infrastructure infrastructure;
@@ -27,7 +27,7 @@ public class MetricsE2ETest {
2727
@Timeout(value = 5, unit = TimeUnit.MINUTES)
2828
public static void setup() {
2929
infrastructure = Infrastructure.builder()
30-
.testName(MetricsE2ETest.class.getSimpleName())
30+
.testName(MetricsE2ET.class.getSimpleName())
3131
.pathToFunction("metrics")
3232
.environmentVariables(new HashMap<>() {{
3333
put("POWERTOOLS_METRICS_NAMESPACE", namespace);

powertools-e2e-tests/src/test/java/software/amazon/lambda/powertools/TracingE2ETest.java renamed to powertools-e2e-tests/src/test/java/software/amazon/lambda/powertools/TracingE2ET.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import static org.assertj.core.api.Assertions.assertThat;
1919
import static software.amazon.lambda.powertools.testutils.lambda.LambdaInvoker.invokeFunction;
2020

21-
public class TracingE2ETest {
21+
public class TracingE2ET {
2222
private static final String service = "TracingE2EService_"+UUID.randomUUID(); // "TracingE2EService_e479fb27-422b-4107-9f8c-086c62e1cd12";
2323

2424
private static Infrastructure infrastructure;
@@ -28,7 +28,7 @@ public class TracingE2ETest {
2828
@Timeout(value = 5, unit = TimeUnit.MINUTES)
2929
public static void setup() {
3030
infrastructure = Infrastructure.builder()
31-
.testName(TracingE2ETest.class.getSimpleName())
31+
.testName(TracingE2ET.class.getSimpleName())
3232
.pathToFunction("tracing")
3333
.tracing(true)
3434
.environmentVariables(new HashMap<>() {{

0 commit comments

Comments
 (0)