1
0
mirror of https://github.com/thib8956/nginx-proxy synced 2025-07-01 14:25:46 +00:00

Merge pull request #1667 from pini-gh/pini-1609

Use `server 127.0.0.1 down` entry only when required
This commit is contained in:
Nicolas Duchon
2021-06-20 18:04:19 +02:00
committed by GitHub
6 changed files with 75 additions and 32 deletions

View File

@ -9,4 +9,4 @@ def test_debug_info_is_present_in_nginx_generated_conf(docker_compose, nginxprox
re.search(r"# Exposed ports: \[\{\d+\.\d+\.\d+\.\d+\s+83\s+tcp \} \{\d+\.\d+\.\d+\.\d+\s+82\s+tcp \}\]", conf)
assert "# Default virtual port: 80" in conf
assert "# VIRTUAL_PORT: 82" in conf
assert conf.count("# /!\ Virtual port not exposed") == 1
assert conf.count("# /!\\ Virtual port not exposed") == 1

View File

@ -0,0 +1,8 @@
import pytest
def test_web_has_no_server_down(docker_compose, nginxproxy):
conf = nginxproxy.get_conf().decode('ASCII')
r = nginxproxy.get("http://web.nginx-proxy.tld/port")
assert r.status_code == 200
assert r.text == "answer from port 81\n"
assert conf.count("server 127.0.0.1 down;") == 0

View File

@ -0,0 +1,13 @@
web:
image: web
expose:
- "81"
environment:
WEB_PORTS: 81
VIRTUAL_HOST: web.nginx-proxy.tld
sut:
image: nginxproxy/nginx-proxy:test
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
- ../lib/ssl/dhparam.pem:/etc/nginx/dhparam/dhparam.pem:ro

View File

@ -0,0 +1,7 @@
import pytest
def test_web_has_server_down(docker_compose, nginxproxy):
conf = nginxproxy.get_conf().decode('ASCII')
r = nginxproxy.get("http://web.nginx-proxy.tld/port")
assert r.status_code in [502, 503]
assert conf.count("server 127.0.0.1 down;") == 1

View File

@ -0,0 +1,14 @@
web:
image: web
expose:
- "81"
environment:
WEB_PORTS: 81
VIRTUAL_HOST: web.nginx-proxy.tld
net: "none"
sut:
image: nginxproxy/nginx-proxy:test
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
- ../lib/ssl/dhparam.pem:/etc/nginx/dhparam/dhparam.pem:ro