davsclaus opened a new pull request, #28993:
URL: https://github.com/apache/camel/pull/28993
Two tests of `camel-jbang-plugin-tui` failed on the first attempt of most PR
builds and passed on the surefire rerun. Of the last 100 `flakes-java-21` CI
artifacts, 91 list `MonitorStartupTest.browserOnlyServesUntilTheServerStops`
and 73 list
`AiCliCommandExecutorTest.productionInvokerRestoresPrinterAndDoesNotQuitMain`.
## MonitorStartupTest.browserOnlyServesUntilTheServerStops: "Connection
refused"
**Root cause:** the test polled a connect with Awaitility `untilAsserted`,
which retries only on an `AssertionError`. The first poll runs 100 ms after the
serving thread starts. If the Netty bind has not finished by then (cold JVM,
busy runner), the `ConnectException` ends the wait at once. The failing CI
attempts took about 0.4 s, far below the 10 s `atMost`. A standalone check with
Awaitility 4.3.0 confirms this: a `ConnectException` thrown inside
`untilAsserted` comes out of the first poll after 111 ms.
**Fix:** wait until `serveBrowserOnly` prints its line, which it does only
after the bind, and then connect once.
##
AiCliCommandExecutorTest.productionInvokerRestoresPrinterAndDoesNotQuitMain:
"Terminal has been closed", exit code 70 (or empty output)
**Root cause:** the module runs its test classes in parallel
(`camel.surefire.parallel=true` in `dsl/pom.xml`). This test points the static
`CamelJBangMain` command line at its own main. Meanwhile
`BorderRenderTest.shellPanelRendersWithBorder` (and `ShellPanelLifecycleTest`)
render a `ShellPanel`, and its shell thread swaps the printer of whatever main
the static points at. The command output then went into the shell panel, giving
empty output, or into its already closed terminal: `IllegalStateException:
Terminal has been closed` from `ShellPanel$2.println`, exit code 70. The CI log
shows `BorderRenderTest` starting while `AiCliCommandExecutorTest` was still
running.
**Fix:** the three tests share a JUnit
`@ResourceLock("CamelJBangMain.commandLine")`, so they no longer overlap.
## Evidence (local, `-Dsurefire.rerunFailingTestsCount=0`)
| Run | Before | After |
|---|---|---|
| `AiCliCommandExecutorTest,BorderRenderTest,ShellPanelLifecycleTest`, 28
busy CPU processes | 8 of 20 runs failed, with the CI messages | 20 of 20
passed |
| `MonitorStartupTest` alone (no load / with load) | 30/30 and 20/20 passed
(too fast locally) | 20 of 20 passed with load |
| Full module suite with load and `-XX:ActiveProcessorCount=2` | 2 of 4 runs
failed: one with the AiCli failure, one with both CI failures | 4 of 4 green
(2285 tests) |
Only test code changes.
_Claude Code on behalf of Claus Ibsen (davsclaus)_
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
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]