Problem setting quarkus.http.host in the integration-tests

683 views
Skip to first unread message

Michael Musgrove

unread,
Jun 9, 2021, 5:50:28 AM6/9/21
to Quarkus Development mailing list
I also raised the following question via zulip but didn't get an answer so I hope you'll forgive me for cross posting ...

I'm writing an integration-test for an extension that I am developing.

The test starts an external service using docker testcontainers and then registers a test endpoint with the external service which the external service will invoke during the test.

The default value for the quarkus property quarkus.http.host is localhost. But the docker container will not be able to invoke the endpoint unless the endpoint is an actual IP address. I am testing it by relying on an environment variable: quarkus.http.host=${HOST:localhost} and setting HOST to one of my network interface addresses.

My question is how can I make this work more generally when quarkus runs the integration tests?

Georgios Andrianakis

unread,
Jun 9, 2021, 5:55:22 AM6/9/21
to michael....@gmail.com, Quarkus Development mailing list
Hi,


On Wed, Jun 9, 2021 at 12:50 PM Michael Musgrove <michael....@gmail.com> wrote:
I also raised the following question via zulip but didn't get an answer so I hope you'll forgive me for cross posting ...

I'm writing an integration-test for an extension that I am developing.

When you say integration test you mean a @QuarkusTest, a @QuarkusIntegrationTest or something else?

The test starts an external service using docker testcontainers and then registers a test endpoint with the external service which the external service will invoke during the test.

The default value for the quarkus property quarkus.http.host is localhost. But the docker container will not be able to invoke the endpoint unless the endpoint is an actual IP address. I am testing it by relying on an environment variable: quarkus.http.host=${HOST:localhost} and setting HOST to one of my network interface addresses.

You can likely set quarkus.http.host=0.0.0.0 (or better yet %test.quarkus.http.host=0.0.0.0) to make Quarkus bind to all hosts

My question is how can I make this work more generally when quarkus runs the integration tests?

--
You received this message because you are subscribed to the Google Groups "Quarkus Development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to quarkus-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/quarkus-dev/a061a534-b089-48ce-909d-0b03fddd9177n%40googlegroups.com.

Michael Musgrove

unread,
Jun 9, 2021, 6:03:54 AM6/9/21
to Quarkus Development mailing list
The integration test is annotated with:

@QuarkusTest
@QuarkusTestResource(LRACoordinatorTestResource.class)
@TestHTTPEndpoint(TransactionalResource.class)

I did try quarkus.http.host=0.0.0.0 earlier.
And I have just tried %test.quarkus.http.host=0.0.0.0 without success.

Michael Musgrove

unread,
Jun 9, 2021, 6:11:13 AM6/9/21
to Quarkus Development mailing list
Actually my docker daemon isn't running so I let me retest use `%test.quarkus.http.host=0.0.0.0` ...

Michael Musgrove

unread,
Jun 9, 2021, 6:58:42 AM6/9/21
to Quarkus Development mailing list
No it still doesn't work:

quarkus.http.host=${HOST:localhost} works where HOST is set to one of my network interfaces
quarkus.http.host=0.0.0.0 doesn't work
%test.quarkus.http.host=0.0.0.0 doesn't work

Perhaps the issue lies with resteasy/quarkus integration. I get the address of the test endpoint via a JAX-RS request filter using:

containerRequestContext.getUriInfo().getBaseURI()

which returns http://192.168.0.14:8081/ when I set quarkus.http.host to one of my local interfaces
but returns http://localhost:8081/ when I set quarkus.http.host to 0.0.0.0

I also set quarkus.http.test-port=8081



Georgios Andrianakis

unread,
Jun 9, 2021, 7:13:36 AM6/9/21
to michael....@gmail.com, Quarkus Development mailing list
Another option would be to launch the external service with host networking (--net=host in Docker terms).
With testcontainers you would do that by setting withNetworkMode("host") on the created container.

Michael Musgrove

unread,
Jun 14, 2021, 12:18:00 PM6/14/21
to gand...@redhat.com, Quarkus Development mailing list
I'll raise the issue with the quarkus/resteasy integration team.

Michael Musgrove

unread,
Jun 15, 2021, 9:07:20 AM6/15/21
to gand...@redhat.com, Quarkus Development mailing list
I raised a pr/17903 for our LRA extension. The windows test environment does not support docker:

> JVM Tests - JDK 11 Windows failed with "Could not find a valid Docker environment. Please see logs and check configuration"

Are you aware of a mechanism to disable windows testing for PRs that require docker?

Georgios Andrianakis

unread,
Jun 15, 2021, 9:13:50 AM6/15/21
to michael....@gmail.com, Quarkus Development mailing list
On Tue, Jun 15, 2021 at 4:07 PM Michael Musgrove <michael....@gmail.com> wrote:
I raised a pr/17903 for our LRA extension. The windows test environment does not support docker:

> JVM Tests - JDK 11 Windows failed with "Could not find a valid Docker environment. Please see logs and check configuration"

Are you aware of a mechanism to disable windows testing for PRs that require docker?

Michael Musgrove

unread,
Jun 15, 2021, 9:50:08 AM6/15/21
to gand...@redhat.com, Aa Michael Musgrove, Quarkus Development mailing list
That's nice and should work for my testcase, I'll update my PR.
Thanks again for your help.



--
Michael Musgrove

JBoss, by Red Hat
Registered Address: Red Hat Ltd, 6700 Cork Airport Business Park, Kinsale Road, Co. Cork.
Registered in the Companies Registration Office, Parnell House, 14 Parnell Square, Dublin 1, Ireland, No.304873
Directors:Michael Cunningham (USA), Vicky Wiseman (USA), Michael O'Neill, Keith Phelan, Matt Parson (USA)


Georgios Andrianakis

unread,
Jun 15, 2021, 9:53:19 AM6/15/21
to Michael Musgrove, Aa Michael Musgrove, Quarkus Development mailing list
YW!
Reply all
Reply to author
Forward
0 new messages