Change ArtifactLauncher.start to return the listening address #51367
+155
−162
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Calling
ArtifactLauncher.startto start Quarkus now returns anOptional<ListeningAddress>, which was already available when starting the process internally. TheListeningAddressis then registered with the testContext, which allows us to avoid using System properties to propagate the running port.This also means that it removes the ability to query
quarkus.http.portandquarkus.http.test-portfrom the test itself usingConfigto get the real port (in case of using a random port for integration tests). From our tests, I don't see us doing that, but that doesn't mean users out there aren't. We could probably add a JUnitParameterResolverto support injection of theListeningAddress, but I'm not sure if this would be the final API we want to expose, since I think it would be interesting to have a unified API for both test and regular runtime. The real port is still registered withRESTAssured, so that is a way to get it if required. Again, this only applies to tests running outside Quarkus.Also,
io.quarkus.test.junit.QuarkusTestProfile#getConfigOverrides, which was being set inSystemProperties, was moved to set the properties directly into the runner arguments, and set directly into theCuratedApplicationwhen we require DevServices. This also means that properties set byio.quarkus.test.junit.QuarkusTestProfile#getConfigOverridescan no longer be retrieved byConfigProvider.getConfigin integration-tests. Unsure if this is something that users use, but I'm thinking that we need to ban the usage ofConfigProvider.getConfig, and offer it as a test parameter, so we can create local instances to each test.If this becomes a big issue, we can temporarily register the ports with System properties again. Hopefully, it shouldn't be required if we can do all the related work in a single release. This relates to:
Splitting this into smaller PRs to make it easier to review and track.