Claus Ibsen created CAMEL-25720:
-----------------------------------
Summary: camel-jbang - Run the tests of camel-jbang-core in
parallel
Key: CAMEL-25720
URL: https://issues.apache.org/jira/browse/CAMEL-25720
Project: Camel
Issue Type: Task
Components: camel-jbang
Reporter: Claus Ibsen
Assignee: Claus Ibsen
Fix For: 4.24.0
The tests of camel-jbang-core run one JVM per test class, one class at a time
({{forkCount=1}}, {{reuseForks=false}}). Aurélien Pupier noted that in a
{{-T1C}} build on Jenkins they take almost 20% of the time, almost alone, as
the module comes late in the build.
The surefire time of the module, measured locally (14 cores, JDK 25):
||Setup||Time||Result||
|today: a new JVM per test class (297 classes), one at a time|399 s|all pass|
|4 reused forks, nothing else changed|116 s|161 tests fail in 56 classes|
|4 reused forks, with the changes below|96 s|all pass|
*Why the tests do not run in parallel*
* {{dsl/pom.xml}} sets {{camel.surefire.parallel=true}}, so with a reused JVM
the classes would run at the same time in one JVM, while the CLI keeps the home
directory in a static field ({{CommandLineHelper.useHomeDir}}).
{{reuseForks=false}} avoids that, at the cost of a JVM per class: half of the
classes run in less than 0.5 seconds.
* Forks share the file system: fixed homes of the tests ({{target}},
{{target/test-action}}, {{target/test-process}}, ...), the working directory of
the module ({{camel run}} deletes {{.camel-jbang}}, {{camel export}} builds in
{{.camel-jbang/work}}, a local {{camel-cli.properties}}), and the fixed port
2121 of the ftp service of {{camel infra run}}.
* A test that sets no home uses the {{~/.camel}} of the developer.
* {{ExportTest}} alone takes 95 seconds: every export builds a new
{{KameletsCatalog}}, which scans the whole classpath, and reads each Quarkus
platform BOM with XPath.
*The change* (two PRs)
# Tests: 4 reused forks, a home of their own per fork ({{user.home}} under
{{target}}) and per test, and the tests that use the working directory or a
fixed port ({{@UsesWorkingDirectory}}, {{@UsesFixedPort}}) run after the
others, one class at a time, in a fork of their own.
# Load a released kamelet catalog, and the versions of a released Quarkus
platform BOM, once per JVM, as camel shell, the TUI, the MCP server and the
tests run several commands in one JVM. {{ExportTest}} then runs in 44 seconds.
*Possible follow-ups*
* {{camel export}} with a staging directory of its own instead of
{{.camel-jbang/work}}, so the export tests can run in the parallel forks too,
and {{ExportTest}} split up: about 50-60 seconds.
* No static home or work directory in the CLI (the embedding item of
CAMEL-25400), so the tests could also run concurrently in one JVM.
_Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v8.20.10#820010)