apupier opened a new pull request, #30330:
URL: https://github.com/apache/camel/pull/30330

   # Description
   
   Fixes flakiness in `RouteDiagramToolsTest` (and any concurrent commands 
performing dump / transform actions) by ensuring `Run.workDir` is set to the 
specific isolated temporary directory rather than defaulting to `.camel-jbang`.
   
   ### Root Cause
   When executing `Run.runTransform(ignoreLoadingError)`, `Run.workDir` was not 
explicitly set by callers (`ActionBaseCommand.dumpRoutesFromSource` and 
`YamlNormalizeCommand.exportYaml`), defaulting to 
`CommandLineHelper.getWorkDir()` (`.camel-jbang`). Consequently, inside 
`JBangRunner.configure()`, `RunPipeline.prepareWorkDir(request.workDir)` 
executed `removeDir(workDir)` on the entire `.camel-jbang` directory. Under 
concurrent execution (such as `RouteDiagramToolsTest.callsAtTheSameTime` or 
parallel test runs), wiping `.camel-jbang` wiped other threads' active 
temporary directories (`.camel-jbang/route-diagram-source-...`), leading to 
`NoSuchFileException`.
   
   ### Fix
   - Made `Run.workDir` field `public`.
   - Set `run.workDir = workDir` in `ActionBaseCommand` and 
`YamlNormalizeCommand` before invoking `runTransform`.
   
   _IBM Bob on behalf of apupier_
   
   # Target
   
   - [x] I checked that the commit is targeting the correct branch (Camel 4 
uses the `main` branch)
   
   # Tracking
   - [x] If this is a large change, bug fix, or code improvement, I checked 
there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for 
the change (usually before you start working on it).
   
   # Apache Camel coding standards and style
   
   - [x] I checked that each commit in the pull request has a meaningful 
subject line and body.
   - [x] I have run `mvn clean install -DskipTests` locally from root folder 
and I have committed all auto-generated changes.
   
   # AI-assisted contributions
   
   - [x] If this PR includes AI-generated code, commits have proper 
co-authorship attribution (e.g., `Co-authored-by` trailers) and the PR 
description identifies the AI tool used.


-- 
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]

Reply via email to