Karm / mandrel-integration-tests

Integration tests for GraalVM and its Mandrel distribution. Runs Quarkus, Helidon and Micronaut applications and small targeted reproducers. The focus is solely on native-image utility and compilation of Java applications into native executables.
Apache License 2.0
5 stars 3 forks source link

UsedVersion.InContainer fails cryptically when image not pulled #148

Closed jerboaa closed 1 year ago

jerboaa commented 1 year ago

Example failure:

Error:  Errors: 
Error:    AppReproducersTest.imageioAWTContainerTest » NoClassDefFound Could not initial...
Error:    JFRTest.jfrOptionsSmokeContainerTest » ExceptionInInitializer
Error:    JFRTest.jfrSmokeContainerTest » NoClassDefFound Could not initialize class org...

Seen here: https://github.com/graalvm/mandrel/actions/runs/4642679968/jobs/8283797496#step:10:11195

Reproducible with something like this:

$ podman rmi quay.io/quarkus/ubi-quarkus-mandrel-builder-image:22.3-java17
$ export QUARKUS_NATIVE_CONTAINER_RUNTIME="podman"
$ export QUARKUS_NATIVE_BUILDER_IMAGE="quay.io/quarkus/ubi-quarkus-mandrel-builder-image:22.3-java17"
$ mvn clean verify -Dquarkus.version=999-SNAPSHOT -Ptestsuite-builder-image -Dtest=AppReproducersTest#imageioAWTContainerTest

Fails then with:

2023-04-12 19:01:33.425 INFO  [o.g.t.i.u.v.UsedVersion$MVersion] (runNativeImageVersion) Running command [podman, run, -t, quay.io/quarkus/ubi-quarkus-mandrel-builder-image:22.3-java17, native-image, --version] to determine Mandrel version used.
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 71.368 s <<< FAILURE! - in org.graalvm.tests.integration.AppReproducersTest
[ERROR] imageioAWTContainerTest{TestInfo}  Time elapsed: 0.007 s  <<< ERROR!
java.lang.ExceptionInInitializerError
Caused by: java.lang.NullPointerException

[INFO] 
[INFO] Results:
[INFO] 
[ERROR] Errors: 
[ERROR]   AppReproducersTest.imageioAWTContainerTest » ExceptionInInitializer
[INFO] 
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for Native image integration TS 1.0.0-SNAPSHOT:
[INFO] 
[INFO] Native image integration TS ........................ SUCCESS [  0.094 s]
[INFO] testsuite .......................................... FAILURE [01:14 min]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  01:14 min
[INFO] Finished at: 2023-04-12T19:02:44+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.2:test (default-test) on project testsuite: There are test failures.
[ERROR] 
[ERROR] Please refer to /disk/graal/upstream-sources/mandrel-integration-tests/testsuite/target/surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <args> -rf :testsuite
jerboaa commented 1 year ago

The reason for this is that if the image isn't pulled, it'll get pulled implicitly by the podman run command, which produces output that confuses the version parsing logic.