@QuarkusIntegrationTest does not start up correctly for native container images with http ports set to 0 (random). Similar to #11891.
Expected behavior
The test should start correctly and pass using a random port for HTTP and HTTPS.
Actual behavior
When running a @QuarkusIntegrationTest using a native containerized image with quarkus.http.test-port=0 and quarkus.http.test-ssl-port=0 you get the following:
Executing [docker, run, --rm, -p, 0:0, -p, 0:0, --env, QUARKUS_HTTP_PORT=0, --env, QUARKUS_HTTP_SSL_PORT=0, --env, TEST_URL=http://localhost:0, arne/code-with-quarkus:1.0.0-SNAPSHOT]
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 11.471 s <<< FAILURE! - in org.acme.NativeGreetingResourceIT
[ERROR] org.acme.NativeGreetingResourceIT.testHelloEndpoint Time elapsed: 0.012 s <<< ERROR!
java.lang.RuntimeException: java.lang.IllegalStateException: Unable to determine the status of the running process. See the above logs for details
Caused by: java.lang.IllegalStateException: Unable to determine the status of the running process. See the above logs for details
Docker is asked to expose the port 0, which is not allowed. Replaying the command in the shell returns
docker: Error response from daemon: driver failed programming external connectivity on endpoint musing_villani (b113766de6c1e230923d504f0b56d4d60133a7a8af4ae72a089fe9d21db298e6): (iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 49232 -j DNAT --to-destination 172.17.0.2:0 ! -i docker0: iptables v1.6.1: Port `0' not valid
Additional problem:
When executing all tests in IntelliJ and the @QuarkusIntegrationTest is executed after a @QuarkusTest, it will find a correct random HTTP port (with quarkus.http.test-port=0):
2021-04-29 11:19:16,834 INFO [io.quarkus] (main) Quarkus 1.13.2.Final on JVM started in 1.552s. Listening on: http://localhost:36011
2021-04-29 11:19:16,855 INFO [io.quarkus] (main) Profile test activated.
2021-04-29 11:19:16,855 INFO [io.quarkus] (main) Installed features: [cdi, resteasy]
Executing [docker, run, --rm, -p, 36011:36011, -p, 0:0, --env, QUARKUS_HTTP_PORT=36011, --env, QUARKUS_HTTP_SSL_PORT=0, --env, TEST_URL=http://localhost:36011, arne/native-image:1.0.0-SNAPSHOT]
java.lang.RuntimeException: java.io.IOException: Cannot run program "docker": target/target/quarkus.log (No such file or directory)
First logs are from the @QuarkusTest, last blocks tarting from Executing for the @QuarkusIntegrationTest. This part I could not reproduce for a new project, because I am not sure how to control the test execution order.
Describe the bug
@QuarkusIntegrationTest
does not start up correctly for native container images with http ports set to 0 (random). Similar to #11891.Expected behavior
The test should start correctly and pass using a random port for HTTP and HTTPS.
Actual behavior
When running a
@QuarkusIntegrationTest
using a native containerized image withquarkus.http.test-port=0
andquarkus.http.test-ssl-port=0
you get the following:Docker is asked to expose the port 0, which is not allowed. Replaying the command in the shell returns
Additional problem: When executing all tests in IntelliJ and the
@QuarkusIntegrationTest
is executed after a@QuarkusTest
, it will find a correct random HTTP port (withquarkus.http.test-port=0
):First logs are from the
@QuarkusTest
, last blocks tarting fromExecuting
for the@QuarkusIntegrationTest
. This part I could not reproduce for a new project, because I am not sure how to control the test execution order.To Reproduce
Steps to reproduce the behavior:
./mvnw quarkus:add-extension -Dextensions="container-image-docker"
@NativeImageTest
to@QuarkusIntegrationTest
mvn verify -Pnative -Dquarkus.container-image.build=true -Dquarkus.native.container-build=true -Dquarkus.native.container-runtime=docker
Worksquarkus.http.test-port=0
andquarkus.http.test-ssl-port=0
to the application.properties filemvn verify -Pnative -Dquarkus.container-image.build=true -Dquarkus.native.container-build=true -Dquarkus.native.container-runtime=docker
FAILSConfiguration
Environment
Output of
uname -a
orver
Linux arne-ThinkPad-T480 4.15.0-142-generic #146-Ubuntu SMP Tue Apr 13 01:11:19 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Output of
java -version
openjdk version "11.0.8" 2020-07-14
GraalVM version (if different from Java)
not installed
Quarkus version or git rev
1.13.2-FINAL
Build tool (ie. output of
mvnw --version
orgradlew --version
)Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
IDE
Intellij IDEA 2020.2.3 (Ultimate Edition)
https://github.com/quarkusio/quarkus/issues/16900
$upstream:16900$