I have been trying out the Quarkus 1.13.0.CR1 release, and I have noticed the following change in behavior (when comparing with Quarkus 1.12.0.Final) regarding QuarkusTestResourceLifecycleManager. Formerly, the start/stop methods of the lifecycle manager were executed before/after the tests are run, however, with the 1.13.0.CR1 version of Quarkus it seems that they are invoked before each relevant test method.
A simplistic reproducer:
Consider the following resource lifecycle manager:
public class LifecycleManager implements QuarkusTestResourceLifecycleManager {
@Override
public Map<String, String> start() {
Counter.startCounter.incrementAndGet();
return Map.of();
}
@Override
public void stop() {
Counter.endCounter.incrementAndGet();
}
}
where Counter is a class containing two static AtomicInteger fields that count start/stop invocations.
I mark the test to use the resource manager with the following annotation:
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@QuarkusTestResource(LifecycleManager.class)
@Stereotype
public @interface CustomResource {}
Now, the following test passes with 1.12.0.Final, but fails with 1.13.0.CR1:
@CustomResource
@QuarkusTest
public class StartTest {
@Test
public void test1() {
assertTrue(Counter.startCounter.get() <= 1);
}
@Test
public void test2() {
assertTrue(Counter.startCounter.get() <= 1);
}
}
The same holds for the test that counts the stop invocations. In case this is a feature, is there a way to retain former behavior?
Hello,
I have been trying out the Quarkus 1.13.0.CR1 release, and I have noticed the following change in behavior (when comparing with Quarkus 1.12.0.Final) regarding
QuarkusTestResourceLifecycleManager
. Formerly, thestart
/stop
methods of the lifecycle manager were executed before/after the tests are run, however, with the 1.13.0.CR1 version of Quarkus it seems that they are invoked before each relevant test method.A simplistic reproducer:
Consider the following resource lifecycle manager:
where
Counter
is a class containing two staticAtomicInteger
fields that countstart
/stop
invocations. I mark the test to use the resource manager with the following annotation:Now, the following test passes with 1.12.0.Final, but fails with 1.13.0.CR1:
The same holds for the test that counts the
stop
invocations. In case this is a feature, is there a way to retain former behavior?I have attached a reproducer project here: quarkus-resource.zip
https://github.com/quarkusio/quarkus/issues/16108
$upstream:16108$