-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Make test resource config override dev service config and system props #48815
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Make test resource config override dev service config and system props #48815
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
6197eea
to
7971356
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
7971356
to
b0ee374
Compare
This comment has been minimized.
This comment has been minimized.
🎊 PR Preview 99c1f2e has been successfully built and deployed to https://quarkus-pr-main-48815-preview.surge.sh/version/main/guides/
|
b0ee374
to
2fc2b7a
Compare
This comment has been minimized.
This comment has been minimized.
2fc2b7a
to
5dbdfae
Compare
This comment has been minimized.
This comment has been minimized.
5dbdfae
to
f349dd1
Compare
This comment has been minimized.
This comment has been minimized.
f349dd1
to
c409e7d
Compare
This comment has been minimized.
This comment has been minimized.
c409e7d
to
4fe21dd
Compare
This comment has been minimized.
This comment has been minimized.
Also switch to runtime config
4fe21dd
to
c39886d
Compare
Status for workflow
|
Status for workflow
|
Status | Name | Step | Failures | Logs | Raw logs | Build scan |
---|---|---|---|---|---|---|
✖ | Native Tests - Windows support | Build |
Failures | Logs | Raw logs | 🔍 |
You can consult the Develocity build scans.
Failures
⚙️ Native Tests - Windows support #
- Failing: integration-tests/liquibase
📦 integration-tests/liquibase
✖ Failed to execute goal io.quarkus:quarkus-maven-plugin:999-SNAPSHOT:build (default) on project quarkus-integration-test-liquibase: Failed to build quarkus application
I can see the windows native liquibase failure in other runs (such as https://github.com/quarkusio/quarkus/actions/runs/16332365795/job/46138054967), so I'm confident it's not caused by this change. |
Resolves #48784
After the big test classloading rewrite, ephemeral ports for the lambda dev service stopped working (that is, if a user sets the port as 0 in
application.properties
, in hopes that they get a randomly assigned one, injected clients will attempt to connect to a port "0"). This issue would also affect other services where a user explicitly configured a port of 0. To fix that, the dev service needs to be moved to the new model, but that's not enough. The lazy config source that knows the random port needs to have a higher priority than the '0' hardcoded in the application properties.Fixing this is (almost) a straightforward matter of bumping the priority (ordinal) to something 400 or higher. Sadly that simple fix creates a ripple of other problems:
MultiClientImportPreloadingTest
in theredis-client
test suite uses a TestResource to start and stop a redis instance, but the test doesn't disable dev services, so there are actually two redis instances. (I've checked, and this is the case even on 3.21.) For some of the test to pass, they needs to connect to the test resource one, not the dev service one, and for that to work, the dev services config needs to be lower priority than application properties. Arguably, this is a slightly silly test for starting things twice, but I don't want to regress behaviour that currently works.KakfaCompanionResource
test resource used by theintegration-tests/reactive-messaging-hibernate-orm
andintegration-tests/opentelemetry-reactive-messaging
tests interacts with the dev services, and for it to work, test resources need to have a higher priority than dev servicesextensions/resteasy-classic/resteasy-client
uses aQuarkusUnitTest.overrideConfigKey
to configure the port to 0.QuarkusUnitTest.overrideConfigKey
uses the sameRuntimeOverrideConfigSource
config source as test resources do. For this test to pass, unit test sources need to have a lower priority than dev service sources.So we have the following desired behaviours:
QuarkusUnitTest().overrideConfigKey
should have a lower priority than dynamic dev services config-Dservice.port=0
wouldn't work).As a hierarchy of priorities, that would be (from highest to lowest):
So I see two options. One is to split the
RuntimeOverrideConfigSource
into two so it can have two priorities for the two different scenarios, and the other is to split the dev service source into an 'underride' and 'override' pair. I worried that I might keep finding scenarios where the test resource config wasn't quite at the right relative priority, whereas the "this should override" vs "this should not override" distinction for dev services seemed clearer. So I went that way.It should be really clean to just say 'only have this as an override if the same property is found in the original, user-defined, config' but getting that list wasn't so easy, and passing in the hardcoded config just made the API really confusing. I wondered about using
ConfigUtils.isPropertyNonEmpty(propName)
but that would be introducing the same problem of fighting with test resource overrides, but with some extra sequencing fun.As part of this, I also had to make the port a runtime config element. Otherwise, CI was green, but there was a warning in the logs.