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

   _IBM Bob on behalf of apupier (AI-generated description)_
   
   JIRA: https://issues.apache.org/jira/browse/CAMEL-27511
   
   ## Problem
   
   
`OpenApiScaffoldRestOpenApiTest.scaffoldedRouteOfAnOperationWithoutOperationIdIsCalled`
 in camel-jbang-mcp fails intermittently (null body or 
`DirectConsumerNotAvailableException`).
   
   ## Cause
   
   - The Camel CLI connector is enabled by default and names its lock file 
after the pid of the JVM, `~/.camel/<pid>`. Every connector-enabled context of 
one JVM shares that file.
   - A missing lock file means shutdown (this is how `camel stop` works), and 
the connector deletes the file when its context closes.
   - `WsdlTools.samples()` (CAMEL-27396) starts a bare `DefaultCamelContext`. 
When it closes, it deletes the shared lock, and the poll of the other contexts 
of the JVM shuts them down while a request is in flight.
   - `camel-jbang-mcp` runs test classes concurrently, so `WsdlToolsTest` and 
`OpenApiScaffoldRestOpenApiTest` overlap.
   
   ## Fix
   
   The context of `camel_wsdl_inspect` goes through 
`ScratchContextHelper.withoutCliConnector`, as the scratch context of 
`ExpressionEvaluator` does since CAMEL-26396. New test 
`WsdlToolsCliConnectorTest` checks that the samples are still made and that no 
`~/.camel` is written. It fails without the change.
   
   ## Measurement
   
   First attempt, no reruns (`-Dsurefire.rerunFailingTestsCount=0`), 
`OpenApiScaffoldRestOpenApiTest` + `WsdlToolsTest` in one JVM, runs one after 
the other:
   
   | | failed runs |
   |---|---|
   | base | 5 of 30 (earlier: 3 of 12, 3 of 8) |
   | with this change | 0 of 30 (and 0 of 30 in an earlier arm) |
   
   Control: the target test alone, and with `OpenApiToolsTest`: 0 of 20 each.
   
   Not covered: other contexts that start a connector in the same JVM. In 
camel-jbang-mcp, `WsdlTools` was the only one found.
   


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