Skip to content

fix: e2e tests on JDK8 #1225

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/run-e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ jobs:
role-to-assume: ${{ secrets.AWS_ROLE_ARN_TO_ASSUME }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
- name: Run e2e test with Maven
run: mvn -Pe2e -B verify --file powertools-e2e-tests/pom.xml
run: mvn -Pbuild-without-spotbugs -DskipTests install --file pom.xml && mvn -Pe2e -B verify --file powertools-e2e-tests/pom.xml
2 changes: 1 addition & 1 deletion powertools-e2e-tests/handlers/parameters/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<groupId>dev.aspectj</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<configuration>
<source>${maven.compiler.source}</source>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,12 @@

import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.RequestHandler;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import software.amazon.lambda.powertools.logging.Logging;
import software.amazon.lambda.powertools.parameters.ParamManager;
import software.amazon.lambda.powertools.parameters.cache.CacheManager;
import software.amazon.lambda.powertools.parameters.AppConfigProvider;
import software.amazon.lambda.powertools.parameters.ParamManager;

public class Function implements RequestHandler<Input, String> {

private static final Logger LOG = LogManager.getLogger(Function.class);

@Logging
public String handleRequest(Input input, Context context) {
AppConfigProvider provider = ParamManager.getAppConfigProvider(input.getEnvironment(), input.getApp());
Expand Down
107 changes: 96 additions & 11 deletions powertools-e2e-tests/handlers/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
<properties>
<lambda.powertools.version>1.15.0</lambda.powertools.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>

<lambda.java.core>1.2.2</lambda.java.core>
<lambda.java.events>3.11.0</lambda.java.events>
<maven.shade.version>3.2.4</maven.shade.version>
<aspectj.version>1.13.1</aspectj.version>
<maven.compiler.version>3.10.1</maven.compiler.version>
<lambda.java.events>3.11.2</lambda.java.events>
<maven.shade.version>3.5.0</maven.shade.version>
<aspectj.plugin.version>1.13.1</aspectj.plugin.version>
<maven.compiler.version>3.11.0</maven.compiler.version>
</properties>

<modules>
Expand Down Expand Up @@ -104,22 +104,107 @@
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>dev.aspectj</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.13.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven.compiler.version}</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
<useIncrementalCompilation>false</useIncrementalCompilation>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>

<profiles>
<profile>
<id>jdk8</id>
<activation>
<jdk>(,11)</jdk> <!-- < 11 -->
</activation>
<properties>
<aspectj.version>1.9.7</aspectj.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjtools</artifactId>
<version>${aspectj.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>dev.aspectj</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>${aspectj.plugin.version}</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
<complianceLevel>${maven.compiler.target}</complianceLevel>
<Xlint>ignore</Xlint>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
<executions>
<execution>
<phase>process-sources</phase>
<goals>
<goal>compile</goal>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
<!-- Enforce aspectJ 1.9.7 -->
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjtools</artifactId>
<version>${aspectj.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>
<profile>
<id>jdk11plus</id>
<activation>
<jdk>[11,)</jdk> <!-- >= 11 -->
</activation>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>dev.aspectj</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>${aspectj.plugin.version}</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
<complianceLevel>${maven.compiler.target}</complianceLevel>
<Xlint>ignore</Xlint>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
<executions>
<execution>
<phase>process-sources</phase>
<goals>
<goal>compile</goal>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>
</profiles>

</project>
5 changes: 2 additions & 3 deletions powertools-e2e-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@
<description>Powertools for AWS Lambda (Java)End-To-End Tests</description>

<properties>
<!-- we can use Java 11 for integration tests, not forced to stick to Java 8 -->
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<constructs.version>10.2.55</constructs.version>
<cdk.version>2.84.0</cdk.version>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package software.amazon.lambda.powertools;

import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.jupiter.api.*;
import software.amazon.lambda.powertools.testutils.AppConfig;
import software.amazon.lambda.powertools.testutils.Infrastructure;
import software.amazon.lambda.powertools.testutils.lambda.InvocationResult;

import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import java.util.stream.Stream;
Expand All @@ -17,19 +17,16 @@

@TestInstance(TestInstance.Lifecycle.PER_CLASS)
public class ParametersE2ET {


private final ObjectMapper objectMapper = new ObjectMapper();

private Infrastructure infrastructure;
private String functionName;
private final AppConfig appConfig;

public ParametersE2ET() {
String appName = UUID.randomUUID().toString();
Map<String,String> params = new HashMap<>();
params.put("key1", "value1");
params.put("key2", "value2");
appConfig = new AppConfig("e2eApp", "e2etest", params);
appConfig = new AppConfig(appName, "e2etest", params);
}
@BeforeAll
@Timeout(value = 5, unit = TimeUnit.MINUTES)
Expand Down