mirror of
https://github.com/thib8956/nginx-proxy
synced 2025-02-24 09:48:14 +00:00
test: add tests for the DEBUG flag
This commit is contained in:
parent
3785649eb6
commit
2bb53bd303
12
test/test_debug/test_proxy-debug-flag.py
Normal file
12
test/test_debug/test_proxy-debug-flag.py
Normal file
@ -0,0 +1,12 @@
|
||||
import pytest
|
||||
import re
|
||||
|
||||
def test_debug_info_is_present_in_nginx_generated_conf(docker_compose, nginxproxy):
|
||||
conf = nginxproxy.get_conf().decode('ASCII')
|
||||
assert re.search(r"# Exposed ports: \[\{\d+\.\d+\.\d+\.\d+\s+80\s+tcp \} \{\d+\.\d+\.\d+\.\d+\s+81\s+tcp \}\]", conf) or \
|
||||
re.search(r"# Exposed ports: \[\{\d+\.\d+\.\d+\.\d+\s+81\s+tcp \} \{\d+\.\d+\.\d+\.\d+\s+80\s+tcp \}\]", conf)
|
||||
assert re.search(r"# Exposed ports: \[\{\d+\.\d+\.\d+\.\d+\s+82\s+tcp \} \{\d+\.\d+\.\d+\.\d+\s+83\s+tcp \}\]", conf) or \
|
||||
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
|
27
test/test_debug/test_proxy-debug-flag.yml
Normal file
27
test/test_debug/test_proxy-debug-flag.yml
Normal file
@ -0,0 +1,27 @@
|
||||
web1:
|
||||
image: web
|
||||
expose:
|
||||
- "80"
|
||||
- "81"
|
||||
environment:
|
||||
WEB_PORTS: "80 81"
|
||||
VIRTUAL_HOST: "web1.nginx-proxy.tld"
|
||||
VIRTUAL_PORT: "82"
|
||||
|
||||
web2:
|
||||
image: web
|
||||
expose:
|
||||
- "82"
|
||||
- "83"
|
||||
environment:
|
||||
WEB_PORTS: "82 83"
|
||||
VIRTUAL_HOST: "web2.nginx-proxy.tld"
|
||||
VIRTUAL_PORT: "82"
|
||||
|
||||
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
|
||||
environment:
|
||||
DEBUG: "true"
|
8
test/test_debug/test_server-debug-flag.py
Normal file
8
test/test_debug/test_server-debug-flag.py
Normal file
@ -0,0 +1,8 @@
|
||||
import pytest
|
||||
import re
|
||||
|
||||
def test_debug_info_is_present_in_nginx_generated_conf(docker_compose, nginxproxy):
|
||||
conf = nginxproxy.get_conf().decode('ASCII')
|
||||
assert re.search(r"# Exposed ports: \[\{\d+\.\d+\.\d+\.\d+\s+80\s+tcp \} \{\d+\.\d+\.\d+\.\d+\s+81\s+tcp \}\]", conf) or \
|
||||
re.search(r"# Exposed ports: \[\{\d+\.\d+\.\d+\.\d+\s+81\s+tcp \} \{\d+\.\d+\.\d+\.\d+\s+80\s+tcp \}\]", conf)
|
||||
assert conf.count("# Exposed ports: [{") == 1
|
26
test/test_debug/test_server-debug-flag.yml
Normal file
26
test/test_debug/test_server-debug-flag.yml
Normal file
@ -0,0 +1,26 @@
|
||||
web1:
|
||||
image: web
|
||||
expose:
|
||||
- "80"
|
||||
- "81"
|
||||
environment:
|
||||
WEB_PORTS: "80 81"
|
||||
VIRTUAL_HOST: "web1.nginx-proxy.tld"
|
||||
VIRTUAL_PORT: "82"
|
||||
DEBUG: "true"
|
||||
|
||||
web2:
|
||||
image: web
|
||||
expose:
|
||||
- "82"
|
||||
- "83"
|
||||
environment:
|
||||
WEB_PORTS: "82 83"
|
||||
VIRTUAL_HOST: "web2.nginx-proxy.tld"
|
||||
VIRTUAL_PORT: "82"
|
||||
|
||||
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
|
Loading…
x
Reference in New Issue
Block a user