1
0
mirror of https://github.com/thib8956/nginx-proxy synced 2025-02-24 01:38:15 +00:00

test: add tests for host mode fix

This commit is contained in:
Nicolas Duchon 2023-04-28 22:23:09 +02:00
parent 325fd01ebb
commit 882e9a3b3c
No known key found for this signature in database
GPG Key ID: EA3151C66A4D79E7
2 changed files with 41 additions and 0 deletions

View File

@ -0,0 +1,13 @@
import pytest
def test_forwards_to_bridge_network_container(docker_compose, nginxproxy):
r = nginxproxy.get("http://bridge-network.nginx-proxy.tld/port")
assert r.status_code == 200
assert r.text == "answer from port 80\n"
def test_forwards_to_host_network_container(docker_compose, nginxproxy):
r = nginxproxy.get("http://host-network.nginx-proxy.tld/port")
assert r.status_code == 200
assert r.text == "answer from port 8080\n"

View File

@ -0,0 +1,28 @@
version: "2"
networks:
net1:
services:
bridge-network:
image: web
environment:
WEB_PORTS: "80"
VIRTUAL_HOST: "bridge-network.nginx-proxy.tld"
networks:
- net1
host-network:
image: web
environment:
WEB_PORTS: "8080"
VIRTUAL_HOST: "host-network.nginx-proxy.tld"
VIRTUAL_PORT: "8080"
network_mode: host
sut:
image: nginxproxy/nginx-proxy:test
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
networks:
- net1