quarkusio / quarkus

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

Confusing documentation or behaviour for `quarkus.test.profile.tags` #35693

Open FWest98 opened 1 year ago

FWest98 commented 1 year ago

Describe the bug

The configurations options page mentions that quarkus.test.profile.tags controls which tests will be run or not. It also mentions an environment variable name that can be used to set this value. This seems to suggest that this value can be controlled in any of the "standard" ways configuration is handled in Quarkus: through yaml files, environment variables, etc.

However, it turns out that this value is only read from the system properties directly (source), and thus setting this value through an environment variable does not work. Additionally, for some reason, using -Dquarkus.test.profile.tags=xyz in my gradle test command also does not seem to pass this property on after the fork. So for me, the only reason to set this field now it by hardcoding it in the Gradle task configuration as outlined here. This seems very limited and is quite inconvenient.

Expected behavior

Ideally, based on the documentation, I would expect this configuration to work through all normal Quarkus config options. However, if that is not possible (due to startup dependencies - I can imagine), then at the very least I would expect the documentation to be more explicit about this. Ideally, then, the respective gradle property should be passed on to the test runtime JVM as well, to ease the use of this setting.

Actual behavior

No response

How to Reproduce?

No response

Output of uname -a or ver

No response

Output of java -version

openjdk version "17.0.8.1"

GraalVM version (if different from Java)

No response

Quarkus version or git rev

3.3.0

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

Gradle 8.1.1

Additional information

No response

edufolly commented 7 months ago

I went through the same problem. I completely agree with what was said by @FWest98.

gsmet commented 3 weeks ago

@radcortez could you clarify this one?

radcortez commented 3 weeks ago

Yes, this is implemented as a single System property. I guess the reason is because the JUnit Test Extension executes very early in the stack, where we don't have the Config set up yet.

We could start a simple SmallRyeConfig instance with only the default sources, as with https://github.com/quarkusio/quarkus/pull/41317. I see no impediment other than extra work during the test initialization. @geoand, you implemented this. Do you know any reason not to?

The documentation does not distinguish specific sources properties (maybe we should consider that).

radcortez commented 3 weeks ago

Relates to https://github.com/quarkusio/quarkus/issues/10233.

radcortez commented 3 weeks ago

Observing https://bugs.openjdk.org/browse/JDK-8276651 with some prototypes. Updating the JDK got rid of the issue.

geoand commented 3 weeks ago

I see no impediment other than extra work during the test initialization. @geoand, you implemented this. Do you know any reason not to?

Yeah, that should work