This is an automated email from the ASF dual-hosted git repository.

gnodet pushed a commit to branch fix-testinfra-container-name-collision
in repository https://gitbox.apache.org/repos/asf/camel.git

commit c00970789b00510dcb6ad85487af686e8f4eee3f
Author: Guillaume Nodet <[email protected]>
AuthorDate: Fri Mar 27 15:19:25 2026 +0100

    test-infra: Keep clean container names for camel infra run
    
    Skip PID+counter suffix when camel.infra.fixedPort=true (set by
    camel infra run) so containers get predictable names like
    camel-postgres for docker exec usability.
    
    Co-Authored-By: Claude Opus 4.6 <[email protected]>
---
 .../test/infra/common/services/ContainerEnvironmentUtil.java      | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git 
a/test-infra/camel-test-infra-common/src/main/java/org/apache/camel/test/infra/common/services/ContainerEnvironmentUtil.java
 
b/test-infra/camel-test-infra-common/src/main/java/org/apache/camel/test/infra/common/services/ContainerEnvironmentUtil.java
index 5aa3da48a394..69cdf3a32ba8 100644
--- 
a/test-infra/camel-test-infra-common/src/main/java/org/apache/camel/test/infra/common/services/ContainerEnvironmentUtil.java
+++ 
b/test-infra/camel-test-infra-common/src/main/java/org/apache/camel/test/infra/common/services/ContainerEnvironmentUtil.java
@@ -116,9 +116,11 @@ public final class ContainerEnvironmentUtil {
             if (annotation.serviceImplementationAlias().length > 0) {
                 name += "-" + annotation.serviceImplementationAlias()[0];
             }
-            // Append PID for cross-JVM uniqueness (parallel builds via mvnd)
-            // and instance counter for within-JVM uniqueness (parallel test 
classes)
-            name += "-" + ProcessHandle.current().pid() + "-" + 
INSTANCE_COUNTER.incrementAndGet();
+            // In fixed port mode (camel infra run), use clean names for 
docker exec usability
+            // Otherwise, append PID + counter for cross-JVM and within-JVM 
uniqueness
+            if 
(!Boolean.parseBoolean(System.getProperty(INFRA_FIXED_PORT_PROPERTY, "false"))) 
{
+                name += "-" + ProcessHandle.current().pid() + "-" + 
INSTANCE_COUNTER.incrementAndGet();
+            }
         } else {
             LOG.warn("InfraService annotation not Found to determine container 
name alias.");
         }

Reply via email to