Rishabh Daim created OAK-12488:
----------------------------------

             Summary: S3Mock endpoint assumes Docker is reachable on JVM 
loopback
                 Key: OAK-12488
                 URL: https://issues.apache.org/jira/browse/OAK-12488
             Project: Jackrabbit Oak
          Issue Type: Bug
          Components: blob-cloud
            Reporter: Rishabh Daim
            Assignee: Rishabh Daim


S3Mock-backed tests can connect to the wrong host when Docker runs remotely or 
in a Docker-in-Docker environment. The helper always uses the JVM loopback 
address instead of the host reported by Testcontainers.

h3. Cause and impact
{{S3MockRule.getHttpEndpoint()}} returns {{http://127.0.0.1:}} plus the mapped 
port. That port is exposed on the Docker host, which need not be the JVM host. 
Container startup can succeed and {{S3EmulatorSupport.isAvailable()}} can 
return true, while subsequent metadata requests fail because they target the 
wrong address. Typical local Docker configurations may be unaffected. This is a 
test-infrastructure issue, not a production datastore defect.

Present on trunk at {{aeff1ea56039f5bfca6ec74995427d8e4991b0df}}:
[S3MockRule endpoint 
construction|https://github.com/apache/jackrabbit-oak/blob/aeff1ea56039f5bfca6ec74995427d8e4991b0df/oak-blob-cloud/src/test/java/org/apache/jackrabbit/oak/blob/cloud/s3/S3MockRule.java#L96-L107]

h3. Reproduction
Run an S3Mock-backed metadata test with a working remote Docker daemon or 
Docker-in-Docker setup where {{container.getHost()}} is not the JVM loopback 
address. Container startup succeeds, but the configured S3 endpoint still uses 
{{127.0.0.1}} and requests target the wrong host.

h3. Expected behavior and fix
Construct the endpoint using {{container.getHost()}} together with 
{{container.getMappedPort(HTTP_PORT)}}. Add focused regression coverage using a 
non-loopback container host and verify the resulting endpoint preserves that 
host and mapped port. Preserve local Docker behavior and the existing handling 
of unavailable Docker.

[Testcontainers networking 
guidance|https://java.testcontainers.org/features/networking/]
Related emulator infrastructure: OAK-12241.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to