diff --git a/src/adapter/inbound/websocket/src/nginxWebSocketTest/java/dev/caskeleton/adapter/inbound/websocket/proxy/NginxWebSocketHarness.java b/src/adapter/inbound/websocket/src/nginxWebSocketTest/java/dev/caskeleton/adapter/inbound/websocket/proxy/NginxWebSocketHarness.java index 70c8859b..3f1173ed 100644 --- a/src/adapter/inbound/websocket/src/nginxWebSocketTest/java/dev/caskeleton/adapter/inbound/websocket/proxy/NginxWebSocketHarness.java +++ b/src/adapter/inbound/websocket/src/nginxWebSocketTest/java/dev/caskeleton/adapter/inbound/websocket/proxy/NginxWebSocketHarness.java @@ -30,12 +30,15 @@ public final class NginxWebSocketHarness implements AutoCloseable { */ @SuppressWarnings("resource") public NginxWebSocketHarness(int applicationPort, String configurationResource) { + // The application listens in this JVM's network, which a container reaches by name only through + // Testcontainers' host-port tunnel. `host-gateway` was the Docker host, which is this JVM's host + // on a workstation but not on a CI runner whose job runs in a container of its own (the Gitea + // runner): there Nginx reached nothing and every upgrade failed as a deployment error. + org.testcontainers.Testcontainers.exposeHostPorts(applicationPort); this.nginx = new GenericContainer<>(IMAGE) .withExposedPorts(8080) - // host.docker.internal is not resolvable on stock Linux Docker; without the gateway - // the container fails with a connection refused that reads as a config error. - .withExtraHost("host.docker.internal", "host-gateway") + .withAccessToHost(true) .withCopyToContainer( Transferable.of(configuration(configurationResource, applicationPort)), "/etc/nginx/nginx.conf"); @@ -68,7 +71,7 @@ public final class NginxWebSocketHarness implements AutoCloseable { throw new IllegalStateException(resource + " is missing from the lane's resources"); } return new String(stream.readAllBytes(), StandardCharsets.UTF_8) - .replace("APPLICATION_HOST", "host.docker.internal") + .replace("APPLICATION_HOST", "host.testcontainers.internal") .replace("APPLICATION_PORT", Integer.toString(applicationPort)); } catch (IOException e) { throw new IllegalStateException(resource + " could not be read", e);