diff --git a/ci/build-docker-e2e-image b/ci/build-docker-e2e-image index bb411c4..a680d60 100755 --- a/ci/build-docker-e2e-image +++ b/ci/build-docker-e2e-image @@ -25,7 +25,6 @@ mkdir -p ${docker_context_dir} cp -rp \ e2e-tests/pom.xml \ e2e-tests/src \ - ci/e2e-tests/e2e-exec-pom.xml \ .mvn \ mvnw \ ${docker_context_dir} diff --git a/ci/e2e-tests/Dockerfile b/ci/e2e-tests/Dockerfile index 6fa46b4..dab4848 100644 --- a/ci/e2e-tests/Dockerfile +++ b/ci/e2e-tests/Dockerfile @@ -26,6 +26,9 @@ RUN ./mvnw -P -dnastack -B -Presolve-dependencies initialize RUN ./mvnw -P -dnastack -B de.qaware.maven:go-offline-maven-plugin:resolve-dependencies RUN ./mvnw -P -dnastack -B versions:set -DnewVersion=${APP_VERSION} +# Delete settings*.xml files that contain GitHub credentials +RUN rm /root/.m2/settings*.xml + # Now add sources, which will bust the cache. ADD target/src ./src @@ -35,7 +38,7 @@ ADD target/src ./src # org.apache.maven.artifact.resolver.MultipleArtifactsNotFoundException: Missing: # then update the version number of surefire-junit4 in pom.xml under the # dynamicDependencies section of go-offline-maven-plugin configuration. -RUN ./mvnw -P -dnastack -B -o package +RUN ./mvnw -P -dnastack -B -o process-test-classes ## @@ -45,18 +48,32 @@ RUN ./mvnw -P -dnastack -B -o package # This stage uses a JRE rather than JDK because it doesn't have to build anything; it just runs the fat jar # produced by the previous stage. FROM amazoncorretto:17-alpine + ARG APP_NAME ARG APP_VERSION -ADD target/e2e-exec-pom.xml /pom.xml -ADD target/.mvn /.mvn -ADD target/mvnw / -COPY --from=0 /build/target/wes-service-e2e-tests-*.jar /e2e-tests.jar -RUN ./mvnw -B de.qaware.maven:go-offline-maven-plugin:resolve-dependencies +# Create a non-root user +RUN adduser -D -h /home/testuser testuser + +USER root +RUN mkdir /target && chown testuser /target + +# Copy required files from build stage into image +COPY --from=build --chown=testuser /build/target/ /home/testuser/target +COPY --from=build --chown=testuser /root/.m2/ /home/testuser/.m2/ +COPY --chown=testuser target/pom.xml /home/testuser/pom.xml +COPY --chown=testuser target/.mvn /home/testuser/.mvn +COPY --chown=testuser target/mvnw /home/testuser + +USER testuser + +WORKDIR /home/testuser + +ENV E2E_SCREENSHOT_DIR /target # If the container has a memory limit, that limit (in bytes) is present in a file under /sys/fs/cgroup # In Linux 5.10.76, the value comes from memory.max. # If the container doesn't have a set memory limit, the file contains "max", hence we fall back to a default value of 2GiB # In Linux 5.4.129, the value comes from memory/memory.limit_in_bytes # If the container doesn't have a set memory limit, the file will be blank, hence we fall back to a default value of 2Gib -ENTRYPOINT ["./mvnw", "-B", "-o", "test"] \ No newline at end of file +ENTRYPOINT ["./mvnw", "-B", "-o", "-DreportsDirectory=/target/surefire-reports", "test"] \ No newline at end of file diff --git a/ci/e2e-tests/e2e-exec-pom.xml b/ci/e2e-tests/e2e-exec-pom.xml deleted file mode 100644 index f914742..0000000 --- a/ci/e2e-tests/e2e-exec-pom.xml +++ /dev/null @@ -1,101 +0,0 @@ - - - 4.0.0 - - com.dnastack - test-runner - 1.0-SNAPSHOT - - - Allows us to run `mvn test` against an arbitrary fat jar inside a Docker image with no additional - dependencies required. - - - - - - - com.dnastack - local-e2e-tests - 1.0 - system - ${project.basedir}/e2e-tests.jar - - - - org.slf4j - slf4j-simple - 1.7.32 - - - - - org.junit.jupiter - junit-jupiter-api - 5.8.2 - test - - - org.junit.jupiter - junit-jupiter-engine - 5.8.2 - test - - - - - - - - maven-surefire-plugin - 3.0.0-M5 - - - - - com.dnastack:local-e2e-tests - - - - - %regex[com.dnastack.*\.class] - - - - - /target - - - - 0 - false - - - - - de.qaware.maven - go-offline-maven-plugin - 1.2.8 - - false - false - - - org.apache.maven.surefire - surefire-junit-platform - 3.0.0-M5 - PLUGIN - - - org.codehaus.plexus - plexus-utils - 1.1 - MAIN - - - - - - - diff --git a/e2e-tests/pom.xml b/e2e-tests/pom.xml index 211af26..d8e6537 100644 --- a/e2e-tests/pom.xml +++ b/e2e-tests/pom.xml @@ -17,6 +17,7 @@ ${java.version} 3.8.1 3.0.0-M5 + 5.8.2 4.5.1 2.0.1 @@ -172,75 +173,19 @@ - - org.apache.maven.plugins - maven-shade-plugin - 3.2.4 - - - package - - shade - - - - - - *:* - - META-INF/*.SF - META-INF/*.DSA - META-INF/*.RSA - - - - - - - - - org.codehaus.mojo - build-helper-maven-plugin - 1.9.1 - - - - add-source - generate-sources - - add-source - - - - ${project.basedir}/src/test/java/ - - - - - - add-resource - generate-resources - - add-resource - - - - - ${project.basedir}/src/test/resources - - - - - - + org.apache.maven.plugins maven-surefire-plugin ${maven-surefire-plugin.version} - true + ${reportsDirectory} + + com.dnastack:actuator-e2e-test + + de.qaware.maven go-offline-maven-plugin diff --git a/e2e-tests/src/main/java/com/dnastack/wes/service/ActuatorE2eTest.java b/e2e-tests/src/test/java/com/dnastack/wes/service/ActuatorE2eTest.java similarity index 100% rename from e2e-tests/src/main/java/com/dnastack/wes/service/ActuatorE2eTest.java rename to e2e-tests/src/test/java/com/dnastack/wes/service/ActuatorE2eTest.java diff --git a/e2e-tests/src/main/java/com/dnastack/wes/service/BaseE2eTest.java b/e2e-tests/src/test/java/com/dnastack/wes/service/BaseE2eTest.java similarity index 100% rename from e2e-tests/src/main/java/com/dnastack/wes/service/BaseE2eTest.java rename to e2e-tests/src/test/java/com/dnastack/wes/service/BaseE2eTest.java diff --git a/e2e-tests/src/main/java/com/dnastack/wes/service/WesE2ETest.java b/e2e-tests/src/test/java/com/dnastack/wes/service/WesE2ETest.java similarity index 100% rename from e2e-tests/src/main/java/com/dnastack/wes/service/WesE2ETest.java rename to e2e-tests/src/test/java/com/dnastack/wes/service/WesE2ETest.java diff --git a/e2e-tests/src/main/java/com/dnastack/wes/service/wdl/WdlSupplier.java b/e2e-tests/src/test/java/com/dnastack/wes/service/wdl/WdlSupplier.java similarity index 100% rename from e2e-tests/src/main/java/com/dnastack/wes/service/wdl/WdlSupplier.java rename to e2e-tests/src/test/java/com/dnastack/wes/service/wdl/WdlSupplier.java diff --git a/e2e-tests/src/main/resources/com/dnastack/wes/service/jwt.pem b/e2e-tests/src/test/resources/com/dnastack/wes/service/jwt.pem similarity index 100% rename from e2e-tests/src/main/resources/com/dnastack/wes/service/jwt.pem rename to e2e-tests/src/test/resources/com/dnastack/wes/service/jwt.pem diff --git a/e2e-tests/src/main/resources/com/dnastack/wes/service/jwt.pub.pem b/e2e-tests/src/test/resources/com/dnastack/wes/service/jwt.pub.pem similarity index 100% rename from e2e-tests/src/main/resources/com/dnastack/wes/service/jwt.pub.pem rename to e2e-tests/src/test/resources/com/dnastack/wes/service/jwt.pub.pem diff --git a/e2e-tests/src/main/resources/com/dnastack/wes/service/wdl/cat_file.wdl b/e2e-tests/src/test/resources/com/dnastack/wes/service/wdl/cat_file.wdl similarity index 100% rename from e2e-tests/src/main/resources/com/dnastack/wes/service/wdl/cat_file.wdl rename to e2e-tests/src/test/resources/com/dnastack/wes/service/wdl/cat_file.wdl diff --git a/e2e-tests/src/main/resources/com/dnastack/wes/service/wdl/md5sum.wdl b/e2e-tests/src/test/resources/com/dnastack/wes/service/wdl/md5sum.wdl similarity index 100% rename from e2e-tests/src/main/resources/com/dnastack/wes/service/wdl/md5sum.wdl rename to e2e-tests/src/test/resources/com/dnastack/wes/service/wdl/md5sum.wdl diff --git a/e2e-tests/src/main/resources/com/dnastack/wes/service/wdl/workflow_with_all_output_types.wdl b/e2e-tests/src/test/resources/com/dnastack/wes/service/wdl/workflow_with_all_output_types.wdl similarity index 100% rename from e2e-tests/src/main/resources/com/dnastack/wes/service/wdl/workflow_with_all_output_types.wdl rename to e2e-tests/src/test/resources/com/dnastack/wes/service/wdl/workflow_with_all_output_types.wdl diff --git a/e2e-tests/src/main/resources/com/dnastack/wes/service/wdl/workflow_with_imports.json b/e2e-tests/src/test/resources/com/dnastack/wes/service/wdl/workflow_with_imports.json similarity index 100% rename from e2e-tests/src/main/resources/com/dnastack/wes/service/wdl/workflow_with_imports.json rename to e2e-tests/src/test/resources/com/dnastack/wes/service/wdl/workflow_with_imports.json diff --git a/e2e-tests/src/main/resources/com/dnastack/wes/service/wdl/workflow_with_imports_1.wdl b/e2e-tests/src/test/resources/com/dnastack/wes/service/wdl/workflow_with_imports_1.wdl similarity index 100% rename from e2e-tests/src/main/resources/com/dnastack/wes/service/wdl/workflow_with_imports_1.wdl rename to e2e-tests/src/test/resources/com/dnastack/wes/service/wdl/workflow_with_imports_1.wdl diff --git a/e2e-tests/src/main/resources/com/dnastack/wes/service/wdl/workflow_with_imports_2.wdl b/e2e-tests/src/test/resources/com/dnastack/wes/service/wdl/workflow_with_imports_2.wdl similarity index 100% rename from e2e-tests/src/main/resources/com/dnastack/wes/service/wdl/workflow_with_imports_2.wdl rename to e2e-tests/src/test/resources/com/dnastack/wes/service/wdl/workflow_with_imports_2.wdl diff --git a/e2e-tests/src/main/resources/com/dnastack/wes/service/wdl/workflow_without_file.json b/e2e-tests/src/test/resources/com/dnastack/wes/service/wdl/workflow_without_file.json similarity index 100% rename from e2e-tests/src/main/resources/com/dnastack/wes/service/wdl/workflow_without_file.json rename to e2e-tests/src/test/resources/com/dnastack/wes/service/wdl/workflow_without_file.json diff --git a/e2e-tests/src/main/resources/com/dnastack/wes/service/wdl/workflow_without_file.wdl b/e2e-tests/src/test/resources/com/dnastack/wes/service/wdl/workflow_without_file.wdl similarity index 100% rename from e2e-tests/src/main/resources/com/dnastack/wes/service/wdl/workflow_without_file.wdl rename to e2e-tests/src/test/resources/com/dnastack/wes/service/wdl/workflow_without_file.wdl diff --git a/e2e-tests/src/main/resources/junit-platform.properties b/e2e-tests/src/test/resources/junit-platform.properties similarity index 100% rename from e2e-tests/src/main/resources/junit-platform.properties rename to e2e-tests/src/test/resources/junit-platform.properties diff --git a/e2e-tests/src/main/resources/simplelogger.properties b/e2e-tests/src/test/resources/simplelogger.properties similarity index 100% rename from e2e-tests/src/main/resources/simplelogger.properties rename to e2e-tests/src/test/resources/simplelogger.properties