jamesnetherton opened a new issue, #9429:
URL: https://github.com/apache/camel-quarkus/issues/9429
### Bug description
Since the upgrade to Quarkus 4.0.0.Beta2, the `functional-extension-tests`
CI job fails intermittently in `test-framework/camel-quarkus-junit-tests`. One
of the `QuarkusDevModeTest` based tests that use `ContinuousTestingTestUtils`
times out after one minute:
```
org.awaitility.core.ConditionTimeoutException: Failed to wait for test run 3
State{lastRun=1, running=true, inProgress=false, run=4, passed=4, failed=0,
skipped=0, isBrokenOnly=false, isTestOutput=false,
isInstrumentationBasedReload=false, isLiveReload=true}
at
io.quarkus.test.ContinuousTestingTestUtils.waitForNextCompletion(ContinuousTestingTestUtils.java:44)
at
org.apache.camel.quarkus.test.extensions.doubeRouteBuilder.DoubleRoutesTest.checkTests(DoubleRoutesTest.java:57)
```
The failing test varies between runs, but it is always the test that runs
immediately after one that performed two continuous testing runs (e.g.
`AnnotationContinuousDevTest` or `ContinuousDevTest`):
- https://github.com/apache/camel-quarkus/actions/runs/41632549663 -
`DoubleRoutesTest`
- https://github.com/apache/camel-quarkus/actions/runs/41486374677 -
`DoubleRoutesTest`
- https://github.com/apache/camel-quarkus/actions/runs/41593694421 -
`ContinuousDevTest`
### Analysis
`ContinuousTestingTestUtils` polls `ContinuousTestingSharedStateManager`,
which is static state shared by every dev mode application started in the same
surefire JVM. Quarkus resets it via a close task registered on the augment
classloader in `TestTracingProcessor`:
```java
((QuarkusClassLoader)
cl.getParent()).addCloseTask(ContinuousTestingSharedStateManager::reset);
```
quarkusio/quarkus#56574 (4.0.0.Beta1) changed `CuratedApplication.close()`
to be a no-op while any runtime classloader is still counted as active.
`JunitTestRunner` notifies `runComplete` (which unblocks the waiting test
method) *before* it closes the test runtime classloader. If the test then tears
down the dev mode application before the test runner thread reaches that close,
`curatedApplication.close()` returns early, the augment classloader is never
closed and the shared state is never reset.
The next `QuarkusDevModeTest` class in the JVM therefore starts polling
against the previous test's `lastRun=2`. `waitForNextCompletion` treats that as
a spurious extra run and bumps the run it waits for to 3, but the new
application only ever produces run 1. Hence `Failed to wait for test run 3`
with `lastRun=1`, where `run=4, passed=4` is the new application's own
completed run being ignored.
The race favours fast machines, so the tests pass locally but fail on the CI
runners.
### Expected behaviour
Continuous testing state should not leak between `QuarkusDevModeTest`
classes, and the tests in `camel-quarkus-junit-tests` should pass reliably on
CI.
### Camel Quarkus version
4.0.0-SNAPSHOT (Quarkus 4.0.0.Beta2)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]