Skip to content

Commit

Permalink
SNOW-1361785 Run e2e jar tests with multiple Java versions
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-lsembera committed May 3, 2024
1 parent eb87281 commit a141b0b
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 55 deletions.
13 changes: 8 additions & 5 deletions .github/workflows/End2EndTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,21 +68,24 @@ jobs:
continue-on-error: false
run: mvn -DghActionsIT verify --batch-mode
build-e2e-jar-test:
name: E2E JAR Test - ${{ matrix.java }}, Cloud ${{ matrix.snowflake_cloud }}
name: E2E JAR Test - Cloud ${{ matrix.snowflake_cloud }}
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
java: [ 8 ]
snowflake_cloud: [ 'AWS', 'AZURE', 'GCP' ]
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Install Java ${{ matrix.java }}
uses: actions/setup-java@v2
- name: Install Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: ${{ matrix.java }}
java-version: | # Install all LTS java versions, the last mentioned one here will be the default
21
17
11
8
cache: maven
- name: Decrypt profile.json for Cloud ${{ matrix.snowflake_cloud }}
env:
Expand Down
77 changes: 59 additions & 18 deletions e2e-jar-test/run_e2e_jar_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ sdk_repo_dir="${maven_repo_dir}/net/snowflake/snowflake-ingest-sdk"
cp profile.json e2e-jar-test/standard
cp profile.json e2e-jar-test/fips

###################
# TEST SHADED JAR #
###################
echo "###################"
echo "# TEST SHADED JAR #"
echo "###################"

# Remove the SDK from local maven repository
rm -fr $sdk_repo_dir
Expand All @@ -25,37 +25,78 @@ rm -fr $sdk_repo_dir
project_version=$(./scripts/get_project_info_from_pom.py pom.xml version)
./scripts/update_project_version.py public_pom.xml $project_version > generated_public_pom.xml

# Build shaded SDK
# Build shaded SDK always with Java 8
echo "Building shaded SDK"
mvn clean package -DskipTests=true --batch-mode --show-version

# Install shaded SDK JARs into local maven repository
mvn install:install-file -Dfile=target/snowflake-ingest-sdk.jar -DpomFile=generated_public_pom.xml

# Run e2e tests
(cd e2e-jar-test && mvn clean verify -pl standard -am)
# Run e2e tests with all supported LTS Java versions
cd e2e-jar-test

#####################
# TEST UNSHADED JAR #
#####################
echo "Testing shaded JAR with Java 8"
mvn --show-version clean verify -pl standard -am # Test with Java 8

echo "Testing shaded JAR with Java 11"
JAVA_HOME="${JAVA_HOME_11_X64}" mvn --show-version clean verify -pl standard -am # Test with Java 11

echo "Testing shaded JAR with Java 17"
JAVA_HOME="${JAVA_HOME_17_X64}" mvn --show-version clean verify -pl standard -am # Test with Java 17

echo "Testing shaded JAR with Java 21"
JAVA_HOME="${JAVA_HOME_21_X64}" mvn --show-version clean verify -pl standard -am # Test with Java 21
cd ..

echo "#####################"
echo "# TEST UNSHADED JAR #"
echo "#####################"

# Remove the SDK from local maven repository
rm -r $sdk_repo_dir

# Install unshaded SDK into local maven repository
# Install unshaded SDK into local maven repository with Java 8
echo "Building unshaded SDK"
mvn clean install -Dnot-shadeDep -DskipTests=true --batch-mode --show-version

# Run e2e tests
(cd e2e-jar-test && mvn clean verify -pl standard -am)
# Run e2e tests with all supported LTS Java versions
cd e2e-jar-test

echo "Testing unshaded JAR with Java 8"
mvn --show-version clean verify -pl standard -am # Test with Java 8

echo "Testing unshaded JAR with Java 11"
JAVA_HOME="${JAVA_HOME_11_X64}" mvn --show-version clean verify -pl standard -am # Test with Java 11

#############
# TEST FIPS #
#############
echo "Testing unshaded JAR with Java 17"
JAVA_HOME="${JAVA_HOME_17_X64}" mvn --show-version clean verify -pl standard -am # Test with Java 17

echo "Testing unshaded JAR with Java 21"
JAVA_HOME="${JAVA_HOME_21_X64}" mvn --show-version clean verify -pl standard -am # Test with Java 21
cd ..

echo "##############"
echo "# TEST FIPS #"
echo "##############"
# Remove the SDK from local maven repository
rm -r $sdk_repo_dir

# Install unshaded SDK into local maven repository
# Install unshaded SDK into local maven repository with Java
echo "Building unshaded SDK for FIPS"
mvn clean install -Dnot-shadeDep -DskipTests=true --batch-mode --show-version

# Run e2e tests on the FIPS module
(cd e2e-jar-test && mvn clean verify -pl fips -am)
# Run e2e tests on the FIPS module with all supported LTS Java versions
cd e2e-jar-test

echo "Testing FIPS JAR with Java 8"
mvn --show-version clean verify -pl standard -am # Test with Java 8

echo "Testing FIPS JAR with Java 11"
JAVA_HOME="${JAVA_HOME_11_X64}" mvn --show-version clean verify -pl standard -am # Test with Java 11

echo "Testing FIPS JAR with Java 17"
JAVA_HOME="${JAVA_HOME_17_X64}" mvn --show-version clean verify -pl standard -am # Test with Java 17

echo "Testing FIPS JAR with Java 21"
JAVA_HOME="${JAVA_HOME_21_X64}" mvn --show-version clean verify -pl standard -am # Test with Java 21
cd ..
59 changes: 27 additions & 32 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
<nimbusds.version>9.37.3</nimbusds.version>
<objenesis.version>3.1</objenesis.version>
<parquet.version>1.13.1</parquet.version>
<powermock.version>2.0.9</powermock.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<protobuf.version>3.19.6</protobuf.version>
<shadeBase>net.snowflake.ingest.internal</shadeBase>
Expand Down Expand Up @@ -517,19 +518,19 @@
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito2</artifactId>
<version>2.0.2</version>
<version>${powermock.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-core</artifactId>
<version>2.0.2</version>
<version>${powermock.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
<version>2.0.2</version>
<version>${powermock.version}</version>
<scope>test</scope>
</dependency>
<!-- Change the 'test' scope to 'runtime' to enable console logging in examples -->
Expand All @@ -556,6 +557,11 @@
<!-- disable default maven deploy plugin since we are using gpg:sign-and-deploy-file -->
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.6.0</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
Expand Down Expand Up @@ -596,7 +602,12 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<version>3.2.5</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.2.0</version>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
Expand Down Expand Up @@ -689,7 +700,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<id>analyze</id>
Expand Down Expand Up @@ -782,7 +792,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<excludes>
<exclude>**/TestSimpleIngestLocal.java</exclude>
Expand Down Expand Up @@ -917,14 +926,22 @@
</activation>
<build>
<plugins>
<!--
Copy all project dependencies to target/dependency-jars. License processing Python script will look here for
license files of SDK dependencies.
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<!--Compile the list of SDK dependencies in 'compile' and 'runtime' scopes. This list is an entry point for the license processing python script. -->
<execution>
<goals>
<goal>list</goal>
</goals>
<phase>generate-resources</phase>
<configuration>
<includeScope>runtime</includeScope>
<outputFile>${license.processing.dependencyListFile}</outputFile>
</configuration>
</execution>
<!--Copy all project dependencies to target/dependency-jars. License processing Python script will look here for license files of SDK dependencies. -->
<execution>
<id>copy-dependencies</id>
<goals>
Expand All @@ -941,28 +958,6 @@
</executions>
</plugin>

<!--
Compile the list of SDK dependencies in 'compile' and 'runtime' scopes.
This list is an entry point for the license processing python script.
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.6.0</version>
<configuration>
<includeScope>runtime</includeScope>
<outputFile>${license.processing.dependencyListFile}</outputFile>
</configuration>
<executions>
<execution>
<goals>
<goal>list</goal>
</goals>
<phase>generate-resources</phase>
</execution>
</executions>
</plugin>

<!-- Relocate all dependencies to internal to solve dependency conflict problem -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down

0 comments on commit a141b0b

Please sign in to comment.