gnodet opened a new pull request, #29701:
URL: https://github.com/apache/camel/pull/29701
## Summary
The serial-test execution (a single fork running `@UsesWorkingDirectory`
tests one class at a time) prevented the export/dependency/transform tests from
running in parallel with the other forks and with each other.
The root cause: all these tests share the `.camel-jbang` work directory
(relative to the Maven working directory), so they cannot run concurrently.
## Changes
**Production code** — replace hardcoded work-dir strings with dynamic calls
to `CommandLineHelper.getWorkDir()`:
- `CamelHome`: add `useWorkDir(Path)` / `resetWorkDir()` (mirrors the
existing `useHomeDir` pattern)
- `DependencyList`: replace `static final EXPORT_DIR` constant with `static
String exportDir()` method
- `SBOMGenerator`: same pattern as `DependencyList`
- `TransformRoute`: use
`CommandLineHelper.getWorkDir().resolve("transform-output." + format)`
- `CamelRouteStructureAction`: use
`CommandLineHelper.getWorkDir().resolve("structure-output-\<pid\>.json")`
**Test support** — `CamelCommandBaseTestSupport.useTestWorkDir()`: creates a
fresh temporary work directory and restores the previous one in `@AfterEach`
(same pattern as the existing `useTestHomeDir()`).
**Test classes** — 11 tests that now use `useTestWorkDir()` have
`@UsesWorkingDirectory` removed so they run in the parallel forks:
| Test class | Change |
|---|---|
| `ExportTest` | extends `CamelCommandBaseTestSupport` + `useTestWorkDir()` |
| `DependencyListTest` | `useTestWorkDir()` in setup |
| `DependencyUpdateTest` | `useTestWorkDir()` in setup |
| `DependencyCopyTest` | extends `CamelCommandBaseTestSupport` +
`useTestWorkDir()` |
| `ExportMainJibTest` | extends `CamelCommandBaseTestSupport` +
`useTestWorkDir()` |
| `ExportMainJkubeTest` | extends `CamelCommandBaseTestSupport` +
`useTestWorkDir()` |
| `InitTest` | extends `CamelCommandBaseTestSupport` + `useTestWorkDir()` |
| `TransformTest` | extends `CamelCommandBaseTestSupport` +
`useTestWorkDir()` |
| `TransformRouteTest` | `useTestWorkDir()` in setup |
| `QuarkusPlatformLookupTest` | extends `CamelCommandBaseTestSupport` +
`useTestWorkDir()` |
| `RouteActionJavaSourceTest` | extends `CamelCommandBaseTestSupport` +
`useTestWorkDir()` |
**Three tests keep `@UsesWorkingDirectory`** and remain in the serial
execution for good reasons:
- `RunExportGoldenTest`: its golden expected files contain the literal
string `.camel-jbang/compile` (the compile work dir is part of the exported
project's `run-settings.properties`), so the test must run with the default
work directory
- `EvalSimpleTest`: starts a live Camel CLI via JBang from outside this JVM;
disabled on CI
- `LoadTest`: starts a `CamelContext` in this JVM and communicates with it
through the CLI connector which reads action files from the user home
## Related
Closes https://issues.apache.org/jira/browse/CAMEL-26818
---
_Forgebot on behalf of gnodet_
--
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]