This is an automated email from the ASF dual-hosted git repository. apupier pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
commit 17174f0a43b3f808f008dad8ee7b3d5dbfe033f4 Author: Aurélien Pupier <[email protected]> AuthorDate: Tue Oct 6 15:43:21 2026 +0200 CAMEL-25341: fix callbackHost() for rootless Podman (netavark/pasta) callbackHost() was inspecting the Docker network named literally "bridge" to find the gateway IP the coordinator container should use to call back to the test JVM. On rootless Podman with the netavark backend (Fedora 44+) there is no network named "bridge" — the default network is named "podman" and uses pasta/slirp4netns for host connectivity. The lookup throws "network not found", so localParticipantUrl is never set correctly and the coordinator's callbacks never reach Camel. All LRA*IT tests then time out waiting for callbacks that never arrive. Fix: instead of inspecting a hardcoded network name via the Docker client API, use container.getContainerInfo().getNetworkSettings() .getNetworks() to iterate the networks the running container is actually attached to and return the first non-empty gateway. This works for both Docker (bridge gateway) and rootless Podman (podman network gateway, typically 10.88.0.1). Also removes the now-unused com.github.dockerjava.api.model.Network import. Co-authored-by: IBM Bob 2.2.1 Signed-off-by: Aurélien Pupier <[email protected]> --- .../MicroprofileLRALocalContainerInfraService.java | 46 +++++++++++++++------- 1 file changed, 32 insertions(+), 14 deletions(-) diff --git a/test-infra/camel-test-infra-microprofile-lra/src/main/java/org/apache/camel/test/infra/microprofile/lra/services/MicroprofileLRALocalContainerInfraService.java b/test-infra/camel-test-infra-microprofile-lra/src/main/java/org/apache/camel/test/infra/microprofile/lra/services/MicroprofileLRALocalContainerInfraService.java index dd8eaf5ffcf8..a8ab96bf5d3f 100644 --- a/test-infra/camel-test-infra-microprofile-lra/src/main/java/org/apache/camel/test/infra/microprofile/lra/services/MicroprofileLRALocalContainerInfraService.java +++ b/test-infra/camel-test-infra-microprofile-lra/src/main/java/org/apache/camel/test/infra/microprofile/lra/services/MicroprofileLRALocalContainerInfraService.java @@ -16,7 +16,6 @@ */ package org.apache.camel.test.infra.microprofile.lra.services; -import com.github.dockerjava.api.model.Network; import org.apache.camel.spi.annotations.InfraService; import org.apache.camel.test.infra.common.LocalPropertyResolver; import org.apache.camel.test.infra.common.services.ContainerEnvironmentUtil; @@ -128,18 +127,37 @@ public class MicroprofileLRALocalContainerInfraService @Override public String callbackHost() { - // Get host ip address from container - Network bridgeNetwork = this.container.getDockerClient() - .inspectNetworkCmd() - .withNetworkId("bridge") - .exec(); - - String networkGateway = bridgeNetwork.getIpam().getConfig().stream() - .filter(config -> config.getGateway() != null) - .findAny() - .map(Network.Ipam.Config::getGateway) - .orElseThrow(() -> new IllegalStateException("Gateway cannot be found in the bridge network")); - - return networkGateway; + // Rootless Podman (netavark/pasta) injects "host.containers.internal" into + // every container's /etc/hosts pointing to the host via the pasta tap + // interface (169.254.1.2). The gateway of the container network (10.88.x.1) + // exists only inside the container namespace and is NOT reachable from the + // host JVM, so using it as localParticipantUrl makes the coordinator's + // callbacks go to an unreachable address. + // + // Docker (and rootful Podman with the bridge driver) does not inject that + // hostname; the bridge gateway (e.g. 172.17.0.1) is the correct host address. + // + // Strategy: if the container's /etc/hosts contains "host.containers.internal" + // use that hostname — always routable from inside the container to the host JVM + // regardless of Podman network driver. Otherwise fall back to the gateway of + // the first connected network (the Docker bridge case). + try { + String hosts = container.execInContainer("cat", "/etc/hosts").getStdout(); + if (hosts != null && hosts.contains("host.containers.internal")) { + return "host.containers.internal"; + } + } catch (Exception e) { + LOG.debug("Could not read /etc/hosts from container, falling back to gateway", e); + } + return container.getContainerInfo() + .getNetworkSettings() + .getNetworks() + .values() + .stream() + .filter(n -> n.getGateway() != null && !n.getGateway().isEmpty()) + .findFirst() + .map(n -> n.getGateway()) + .orElseThrow(() -> new IllegalStateException( + "No network with a gateway found for the LRA coordinator container")); } }
