quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.73k stars 2.67k forks source link

quarkus.keycloak.devservices.port is not exposed #20220

Closed ghost closed 3 years ago

ghost commented 3 years ago

Describe the bug

Using quarkus.keycloak.devservices.port in application.properties yields the following exception :

2021-09-16 16:27:01,580 WARN  [org.tes.con.wai.str.HttpWaitStrategy] (build-21) Unexpected error occurred - will proceed to try to wait anyway: java.lang.IllegalStateException: Target port 1337 is not exposed
    at org.testcontainers.containers.wait.strategy.HttpWaitStrategy.lambda$waitUntilReady$2(HttpWaitStrategy.java:197)
    at java.base/java.util.Optional.orElseThrow(Optional.java:408)
    at org.testcontainers.containers.wait.strategy.HttpWaitStrategy.waitUntilReady(HttpWaitStrategy.java:197)
    at org.testcontainers.containers.wait.strategy.AbstractWaitStrategy.waitUntilReady(AbstractWaitStrategy.java:35)
    at org.testcontainers.containers.GenericContainer.waitUntilContainerStarted(GenericContainer.java:892)
    at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:440)
    at org.testcontainers.containers.GenericContainer.lambda$doStart$0(GenericContainer.java:325)
    at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:81)
    at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:323)
    at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:311)
    at io.quarkus.oidc.deployment.devservices.keycloak.KeycloakDevServicesProcessor.startContainer(KeycloakDevServicesProcessor.java:236)
    at io.quarkus.oidc.deployment.devservices.keycloak.KeycloakDevServicesProcessor.startKeycloakContainer(KeycloakDevServicesProcessor.java:128)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:820)
    at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
    at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
    at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
    at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
    at java.base/java.lang.Thread.run(Thread.java:829)
    at org.jboss.threads.JBossThread.run(JBossThread.java:501)

Expected behavior

No stacktrace displayed.

Actual behavior

The container starts properly, configurations are also applied (i.e. quarkus.keycloak.devservices.realm-path). It looks like a false positive AFAIK.

The error probably stems from KeycloakDevServicesProcessor.java:369, which eventually triggers the exception here HttpWaitStrategy.java:194.

So I'm unsure wether the responsability falls upon testcontainers or something is missing on this side.

How to Reproduce?

https://github.com/9too/quarkus-keycloak-issue

Output of uname -a or ver

Linux 5.10.27-gentoo x86_64 Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz;

Output of java -version

OpenJDK Runtime Environment 11.0.11_p9-r1 (build 11.0.11+9)

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.2.2.Final

Build tool (ie. output of mvnw --version or gradlew --version)

6.9

Additional information

No response

quarkus-bot[bot] commented 3 years ago

/cc @pedroigor, @sberyozkin, @stuartwdouglas

geoand commented 3 years ago

I can confirm it's a false error, but in any case https://github.com/quarkusio/quarkus/pull/20449 will take care of it