You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "gnodet (via GitHub)" <gi...@apache.org> on 2026/03/27 10:58:37 UTC
Re: [PR] test-infra: Fix Docker container name collisions in parallel execution [camel]
gnodet commented on code in PR #22287:
URL: https://github.com/apache/camel/pull/22287#discussion_r3000325762
##########
test-infra/camel-test-infra-common/src/main/java/org/apache/camel/test/infra/common/services/ContainerEnvironmentUtil.java:
##########
@@ -114,6 +114,9 @@ public static String containerName(Class cls) {
if (annotation.serviceImplementationAlias().length > 0) {
name += "-" + annotation.serviceImplementationAlias()[0];
}
+ // Append PID to avoid Docker container name conflicts when multiple
+ // modules run tests in parallel (e.g., via mvnd with multiple threads)
+ name += "-" + ProcessHandle.current().pid();
Review Comment:
You were right that PID alone wasn't sufficient — there is indeed a within-JVM gap when test classes run in parallel. I've updated the fix to use PID + AtomicInteger counter, which covers both dimensions:
- **PID**: cross-JVM uniqueness (mvnd parallel builds)
- **Counter**: within-JVM uniqueness (parallel test classes)
Thread ID specifically wouldn't have worked (not unique across JVMs, and two services created on the same thread would still collide), but your instinct was correct. Thanks for pushing on this!
_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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org