[ 
https://issues.apache.org/jira/browse/CAMEL-25720?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claus Ibsen resolved CAMEL-25720.
---------------------------------
    Resolution: Fixed

Done in two PRs on main:
* https://github.com/apache/camel/pull/28004 (9250de96834f): the tests run in 4 
reused forks, each with a home of its own; the tests that use the working 
directory or a fixed port run after the others in a fork of their own. 
NoFixedHomeDirTest fails on a test with a fixed home, and AGENTS.md (CLAUDE.md) 
of the module tells coding agents how the tests run.
* https://github.com/apache/camel/pull/28005 (1ad29093abba): the kamelet 
catalog and the Quarkus BOM versions are read once per JVM; ExportTest runs in 
44 seconds instead of 95.

The reused JVMs showed a startup race in camel-core, fixed first in CAMEL-25734 
(https://github.com/apache/camel/pull/28003).

Locally the surefire time of camel-jbang-core went from 399 to 96 seconds. The 
number of forks is the property camel.surefire.forkCount.

_Claude Code on behalf of davsclaus_

> 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
>            Priority: Minor
>             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)

Reply via email to