Quarkus forgets config properties in ITs with "Instance per class"
Describe the bug
Some of our tests use @TestInstance(TestInstance.Lifecycle.PER_CLASS) for historical reasons or because of expensive initialization code.
When switching from Quarkus 3.33 to Quarkus 3.39, we realized that some of our tests are breaking, because in-between tests, Quarkus seems to "forgets" config properties that were set by our QuarkusTestResourceLifecycleManager.
The attached reproducer displays the problem. It is a very simple setup, where a QuarkusTestResourceLifecycleManager sets some config property and within the test, we check whether we can access that config property. We have two variants included: One with and one without the @TestInstance(TestInstance.Lifecycle.PER_CLASS) annotation, both as a QuarkusTest and a corresponding QuarkusIntegrationTest.
On Quarkus 3.33, all tests succeeded. Same on Quarkus 3.34.1. Starting with Quarkus 3.35, up to Quarkus 3.39, the QuarkusIntegrationTest with "PER_CLASS" annotation fails, the three other tests succeed: both Test and IT with "PER_METHOD", but also the Test with "PER_CLASS". So the combination of IT and "PER_CLASS" is the only one that behaves differently: The config property is accessible upon execution of the first test method, but is null on the second test method. We also tried adding more test methods. The config property is only accessible in the first test method. So the ConfigProvider seems to be "reset" between test methods (independently from the @TestInstance annotation), but only in ITs and not in QuarkusTests.
Expected behavior
I would love to see support for "PER_CLASS" execution, but I would at least expect consistent behavior between QuarkusTest and QuarkusIntegrationTest (make "PER_CLASS" work for both of them or not at all).
Actual behavior
Inconsistent behavior between QuarkusTest and QuarkusIntegrationTest: @TestInstance(TestInstance.Lifecycle.PER_CLASS) works in tests but breaks ITs if you try to access config properties set by a QuarkusTestResourceLifecycleManager from within the test.
How to Reproduce?
See attached reproducer which works with Quarkus <= 3.34.1 but breaks with Quarkus >= 3.35.0
Output of uname -a or ver
No response
Output of java -version
Java 21
Quarkus version or git rev
3.39.4
Build tool (ie. output of mvnw --version or gradlew --version)
mvn
Additional information
Source: quarkusio/quarkus