Set up config correctly for isolated @QuarkusMainTests #50031
+47
−16
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.
Resolves #49780 (comment)
The fact that
@QuarkusMainTest
s pass when combined with@QuarkusTest
s but fail otherwise gave the clue to the fix. The FacadeClassLoader initialises config on classloaders it creates, but if there's no@QuarkusTest
, it won't create one.In normal testing mode, the parent classloader of the FCL is the app classloader, and that gets the test config initialised on it in some other path. (I can't remember exactly where). But in continuous testing mode, the parent classloader of the FCL is a QuarkusClassLoader, for performance reasons (that classloader has already done a lot of the work of classpath resolution and loading the classes). So a natural fix is to add the test config onto that QuarkusClassLoader.
This isn't quite enough of a fix, because during test execution, in continuous testing mode, the TCCL is the FCL. If the TCCL is the FCL, that stops the config on the QuarkusClassLoader being found. The TCCL really shouldn't be the FCL, but it happens because the launcher session gets started twice in continuous testing mode. We detect that condition for Eclipse, so I've generalised the guard.
In a follow-up PR, I'd like to:
AbstractJVMTestExtension
, since I think I might have fixed all the cases where the TCCL comes in wrong