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

   ## Summary
   
   - Append JVM PID to Docker container names generated by 
`ContainerEnvironmentUtil.containerName()` to prevent `409 Conflict` errors 
when multiple modules sharing the same test infrastructure run integration 
tests in parallel (e.g., via mvnd)
   
   ## Problem
   
   When mvnd tests multiple modules in parallel that share the same test infra 
service (e.g., `camel-elasticsearch` and `camel-elasticsearch-rest-client` both 
use `camel-test-infra-elasticsearch`), each JVM tries to create a Docker 
container with the same hardcoded name (e.g., `camel-elasticsearch`). The 
second JVM fails with:
   
   ```
   ConflictException: Status 409: The container name "/camel-elasticsearch" is 
already in use
   ```
   
   This causes all integration tests in the losing module to fail, as seen in 
#22237.
   
   ## Fix
   
   Append `ProcessHandle.current().pid()` to the container name, making it 
unique per JVM (e.g., `camel-elasticsearch-12345`). This is safe because:
   
   - The container name is only used for `cmd.withName()` (Docker 
identification), never for network aliases or inter-container communication
   - Within a single JVM, the PID is constant so the `SingletonService` pattern 
still works
   - Camel JBang `infra run/stop/ps` manages services by JVM PID, not Docker 
container names
   - Also improves crash recovery: a zombie container from a crashed JVM no 
longer blocks the next run
   
   ## Test plan
   
   - [x] `mvn install -B -pl test-infra/camel-test-infra-common -DskipTests` 
compiles successfully
   - [ ] CI passes with parallel module testing
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   
   _Claude Code on behalf of Guillaume Nodet_


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