-
Notifications
You must be signed in to change notification settings - Fork 2.8k
[Test][ClassLoader] Quarkus 3.22 throws when tests run with junit-platform.properties resource file #47646
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
Comments
I wonder if my own issue is related? If you have a package-private constructor or method in one (gradle) subproject (call it "A") and try to use it in another subproject (call it "tests") via extending the class (yes, split-package is discouraged, and this is probably why, but I digress), the class in "tests" is loaded in a different classloader than the parent class in "A", causing an
This compiles perfectly fine, but when it's executed we find that For context: in our service, This exact arrangement functions as-is in 3.21.4 but breaks on upgrade to 3.22.1. I'm not opposed to changing the visibility of the methods/ctors in question, but I wonder what exact change may have led to this and whether it could be a bug or intended behaviour. And, yes, split-packages are discouraged, and I should probably make the change if only for that reason alone, but again... same question: bug or intentional. |
@kevinross could you maybe create a separate issue with a reproducer? I'm not sure both are related and it's probably better to track them separately. |
/cc @geoand (testing) |
/cc @holly-cummins |
Ah yes, this is definitely related to my changes. There may be a workaround, I'll have a look. |
Should I create a new ticket then...? I commented on this one due to the clear connection to classloaders in the stacktrace - but I'm happy to create a new one and attach a proper reproducer. |
Yes please, @kevinross. The root cause is most likely the same (#34681), but I suspect the fix for your issue will be very different. The changes in 3.22 are intended to avoid the sort of "tests in wrong classloader" problem you're seeing but obviously didn't have the intended effect for your scenario. |
Describe the bug
Might be related to https://quarkus.io/blog/test-classloading-rewrite/
If you create a
junit-platform.properties
file insrc/test/resources
and run./gradlew test
it throwsPrior to 3.22, this wouldn't throw.
Expected behavior
It should run.
Actual behavior
It throws
How to Reproduce?
https://github.com/lloydmeta/quarkus-3.22-test-bug-repo
Output of
uname -a
orver
24.4.0 Darwin Kernel Version 24.4.0: Fri Apr 11 18:28:23 PDT 2025; root:xnu-11417.101.15~117/RELEASE_X86_64 x86_64
Output of
java -version
java 23.0.2 2025-01-21
Quarkus version or git rev
3.22.1
Build tool (ie. output of
mvnw --version
orgradlew --version
)Gradle 8.13
Additional information
Workarounds
The text was updated successfully, but these errors were encountered: