1
0
mirror of https://github.com/thib8956/nginx-proxy synced 2025-02-23 17:28:14 +00:00

tests: review comments

This commit is contained in:
Nicolas Duchon 2024-12-27 16:16:55 +01:00
parent 1e9745f604
commit ea99c1a6f9
47 changed files with 78 additions and 80 deletions

View File

@ -11,7 +11,7 @@ services:
expose:
- "81"
environment:
WEB_PORTS: 81
WEB_PORTS: "81"
VIRTUAL_HOST: web1.nginx-proxy.example
web2:
@ -19,7 +19,7 @@ services:
expose:
- "82"
environment:
WEB_PORTS: 82
WEB_PORTS: "82"
VIRTUAL_HOST: web2.nginx-proxy.example
web3:
@ -27,5 +27,5 @@ services:
expose:
- "83"
environment:
WEB_PORTS: 83
WEB_PORTS: "83"
VIRTUAL_HOST: web3.nginx-proxy.example

View File

@ -10,7 +10,7 @@ services:
expose:
- "81"
environment:
WEB_PORTS: 81
WEB_PORTS: "81"
VIRTUAL_HOST: web1.nginx-proxy.example
web2:
@ -18,5 +18,5 @@ services:
expose:
- "82"
environment:
WEB_PORTS: 82
WEB_PORTS: "82"
VIRTUAL_HOST: web2.nginx-proxy.example

View File

@ -11,7 +11,7 @@ services:
expose:
- "81"
environment:
WEB_PORTS: 81
WEB_PORTS: "81"
VIRTUAL_HOST: web1.nginx-proxy.example
web2:
@ -19,7 +19,7 @@ services:
expose:
- "82"
environment:
WEB_PORTS: 82
WEB_PORTS: "82"
VIRTUAL_HOST: web2.nginx-proxy.example
regex:
@ -27,5 +27,5 @@ services:
expose:
- "83"
environment:
WEB_PORTS: 83
WEB_PORTS: "83"
VIRTUAL_HOST: ~^regex.*\.nginx-proxy\.example$

View File

@ -11,7 +11,7 @@ services:
expose:
- "81"
environment:
WEB_PORTS: 81
WEB_PORTS: "81"
VIRTUAL_HOST: web1.nginx-proxy.example
web2:
@ -19,7 +19,7 @@ services:
expose:
- "82"
environment:
WEB_PORTS: 82
WEB_PORTS: "82"
VIRTUAL_HOST: web2.nginx-proxy.example
regex:
@ -27,5 +27,5 @@ services:
expose:
- "83"
environment:
WEB_PORTS: 83
WEB_PORTS: "83"
VIRTUAL_HOST: ~^regex.*\.nginx-proxy\.example$

View File

@ -10,7 +10,7 @@ services:
expose:
- "81"
environment:
WEB_PORTS: 81
WEB_PORTS: "81"
VIRTUAL_HOST: web1.nginx-proxy.example
web2:
@ -18,5 +18,5 @@ services:
expose:
- "82"
environment:
WEB_PORTS: 82
WEB_PORTS: "82"
VIRTUAL_HOST: web2.nginx-proxy.example

View File

@ -11,7 +11,7 @@ services:
expose:
- "81"
environment:
WEB_PORTS: 81
WEB_PORTS: "81"
VIRTUAL_HOST: enabled.debug.nginx-proxy.example
debug_stripped:
@ -19,7 +19,7 @@ services:
expose:
- "82"
environment:
WEB_PORTS: 82
WEB_PORTS: "82"
VIRTUAL_HOST_MULTIPORTS: |-
stripped.debug.nginx-proxy.example:
"/1":
@ -56,7 +56,7 @@ services:
expose:
- "83"
environment:
WEB_PORTS: 83
WEB_PORTS: "83"
VIRTUAL_HOST: disabled.debug.nginx-proxy.example
labels:
com.github.nginx-proxy.nginx-proxy.debug-endpoint: "false"

View File

@ -9,7 +9,7 @@ services:
expose:
- "81"
environment:
WEB_PORTS: 81
WEB_PORTS: "81"
VIRTUAL_HOST: disabled1.debug.nginx-proxy.example
debug_disabled2:
@ -17,7 +17,7 @@ services:
expose:
- "82"
environment:
WEB_PORTS: 82
WEB_PORTS: "82"
VIRTUAL_HOST: disabled2.debug.nginx-proxy.example
@ -26,7 +26,7 @@ services:
expose:
- "83"
environment:
WEB_PORTS: 83
WEB_PORTS: "83"
VIRTUAL_HOST: enabled.debug.nginx-proxy.example
labels:
com.github.nginx-proxy.nginx-proxy.debug-endpoint: "true"

View File

@ -5,7 +5,7 @@ services:
expose:
- "81"
environment:
WEB_PORTS: 81
WEB_PORTS: "81"
VIRTUAL_HOST: web1.tld
# WHEN nginx-proxy runs with DEFAULT_HOST set to web1.tld

View File

@ -4,7 +4,7 @@ services:
expose:
- "81"
environment:
WEB_PORTS: 81
WEB_PORTS: "81"
VIRTUAL_HOST: web1.nginx-proxy.tld
web2:
@ -12,7 +12,7 @@ services:
expose:
- "82"
environment:
WEB_PORTS: 82
WEB_PORTS: "82"
VIRTUAL_HOST: web2.nginx-proxy.tld
sut:

View File

@ -1 +0,0 @@
nginx.tmpl

View File

@ -19,7 +19,7 @@ services:
expose:
- "80"
environment:
WEB_PORTS: 80
WEB_PORTS: "80"
VIRTUAL_HOST: whoami.nginx.container.docker
volumes:

View File

@ -4,7 +4,7 @@ services:
expose:
- "80"
environment:
WEB_PORTS: 80
WEB_PORTS: "80"
VIRTUAL_HOST: web.nginx-proxy.tld
web-server-tokens-off:
@ -12,7 +12,7 @@ services:
expose:
- "80"
environment:
WEB_PORTS: 80
WEB_PORTS: "80"
VIRTUAL_HOST: web-server-tokens-off.nginx-proxy.tld
SERVER_TOKENS: "off"

View File

@ -4,7 +4,7 @@ services:
expose:
- "80"
environment:
WEB_PORTS: 80
WEB_PORTS: "80"
VIRTUAL_HOST: web.nginx-proxy.tld
web-server-tokens-off:
@ -12,7 +12,7 @@ services:
expose:
- "80"
environment:
WEB_PORTS: 80
WEB_PORTS: "80"
VIRTUAL_HOST: web-server-tokens-off.nginx-proxy.tld
SERVER_TOKENS: "off"

View File

@ -4,7 +4,7 @@ services:
expose:
- "80"
environment:
WEB_PORTS: 80
WEB_PORTS: "80"
VIRTUAL_HOST: ~^regex.*\.nginx-proxy\.example$
sut:

View File

@ -4,7 +4,7 @@ services:
expose:
- "80"
environment:
WEB_PORTS: 80
WEB_PORTS: "80"
VIRTUAL_HOST: htpasswd.nginx-proxy.tld
sut:

View File

@ -4,7 +4,7 @@ services:
expose:
- "80"
environment:
WEB_PORTS: 80
WEB_PORTS: "80"
VIRTUAL_HOST: htpasswd.nginx-proxy.tld
VIRTUAL_PATH: /foo/
VIRTUAL_DEST: /

View File

@ -4,7 +4,7 @@ services:
expose:
- "80"
environment:
WEB_PORTS: 80
WEB_PORTS: "80"
VIRTUAL_HOST: http2-global-disabled.nginx-proxy.tld
sut:

View File

@ -4,7 +4,7 @@ services:
expose:
- "80"
environment:
WEB_PORTS: 80
WEB_PORTS: "80"
VIRTUAL_HOST: http3-global-disabled.nginx-proxy.tld
sut:

View File

@ -4,7 +4,7 @@ services:
expose:
- "80"
environment:
WEB_PORTS: 80
WEB_PORTS: "80"
VIRTUAL_HOST: http3-global-enabled.nginx-proxy.tld
sut:

View File

@ -4,7 +4,7 @@ services:
expose:
- "80"
environment:
WEB_PORTS: 80
WEB_PORTS: "80"
VIRTUAL_HOST: http3-vhost-enabled.nginx-proxy.tld
labels:
com.github.nginx-proxy.nginx-proxy.http3.enable: "true"
@ -14,7 +14,7 @@ services:
expose:
- "80"
environment:
WEB_PORTS: 80
WEB_PORTS: "80"
VIRTUAL_HOST: http3-vhost-disabled.nginx-proxy.tld
labels:
com.github.nginx-proxy.nginx-proxy.http3.enable: "false"
@ -24,7 +24,7 @@ services:
expose:
- "80"
environment:
WEB_PORTS: 80
WEB_PORTS: "80"
VIRTUAL_HOST: http3-vhost-default-disabled.nginx-proxy.tld
sut:

View File

@ -4,7 +4,7 @@ services:
expose:
- "81"
environment:
WEB_PORTS: 81
WEB_PORTS: "81"
VIRTUAL_HOST: web1.nginx-proxy.example
NETWORK_ACCESS: internal
@ -13,7 +13,7 @@ services:
expose:
- "82"
environment:
WEB_PORTS: 82
WEB_PORTS: "82"
VIRTUAL_HOST: web2.nginx-proxy.example
sut:

View File

@ -4,7 +4,7 @@ services:
expose:
- "81"
environment:
WEB_PORTS: 81
WEB_PORTS: "81"
VIRTUAL_HOST: nginx-proxy.example
VIRTUAL_PATH: /web1/
VIRTUAL_DEST: /
@ -15,7 +15,7 @@ services:
expose:
- "82"
environment:
WEB_PORTS: 82
WEB_PORTS: "82"
VIRTUAL_HOST: nginx-proxy.example
VIRTUAL_PATH: /web2/
VIRTUAL_DEST: /

View File

@ -16,7 +16,7 @@ services:
expose:
- "80"
environment:
WEB_PORTS: 80
WEB_PORTS: "80"
VIRTUAL_HOST: ipv4only.nginx-proxy.tld
networks:
ipv4net:

View File

@ -16,7 +16,7 @@ services:
expose:
- "80"
environment:
WEB_PORTS: 80
WEB_PORTS: "80"
VIRTUAL_HOST: ipv4only.nginx-proxy.tld
networks:
ipv4net:

View File

@ -11,7 +11,7 @@ services:
expose:
- "81"
environment:
WEB_PORTS: 81
WEB_PORTS: "81"
VIRTUAL_HOST: web1.nginx-proxy.tld
networks:
- net1
@ -21,7 +21,7 @@ services:
expose:
- "82"
environment:
WEB_PORTS: 82
WEB_PORTS: "82"
VIRTUAL_HOST: web2.nginx-proxy.tld
networks:
- net1

View File

@ -4,7 +4,7 @@ services:
expose:
- "80"
environment:
WEB_PORTS: 80
WEB_PORTS: "80"
VIRTUAL_HOST: keepalive-disabled.nginx-proxy.test
labels:
com.github.nginx-proxy.nginx-proxy.keepalive: "disabled"
@ -14,7 +14,7 @@ services:
expose:
- "80"
environment:
WEB_PORTS: 80
WEB_PORTS: "80"
VIRTUAL_HOST: keepalive-enabled.nginx-proxy.test
labels:
com.github.nginx-proxy.nginx-proxy.keepalive: "64"
@ -27,7 +27,7 @@ services:
expose:
- "80"
environment:
WEB_PORTS: 80
WEB_PORTS: "80"
VIRTUAL_HOST: keepalive-auto.nginx-proxy.test
sut:

View File

@ -4,7 +4,7 @@ services:
expose:
- "81"
environment:
WEB_PORTS: 81
WEB_PORTS: "81"
VIRTUAL_HOST: loadbalance-enabled.nginx-proxy.tld
labels:
com.github.nginx-proxy.nginx-proxy.loadbalance: "hash $$remote_addr;"
@ -16,7 +16,7 @@ services:
expose:
- "82"
environment:
WEB_PORTS: 82
WEB_PORTS: "82"
VIRTUAL_HOST: loadbalance-disabled.nginx-proxy.tld
deploy:
replicas: 2

View File

@ -4,7 +4,7 @@ services:
expose:
- "81"
environment:
WEB_PORTS: 81
WEB_PORTS: "81"
VIRTUAL_HOST: nginx-proxy.test
sut:

View File

@ -4,7 +4,7 @@ services:
expose:
- "81"
environment:
WEB_PORTS: 81
WEB_PORTS: "81"
VIRTUAL_HOST: nginx-proxy.test
sut:

View File

@ -4,7 +4,7 @@ services:
expose:
- "81"
environment:
WEB_PORTS: 81
WEB_PORTS: "81"
VIRTUAL_HOST: nginx-proxy.test
sut:

View File

@ -4,7 +4,7 @@ services:
expose:
- "81"
environment:
WEB_PORTS: 81
WEB_PORTS: "81"
VIRTUAL_HOST: nginx-proxy.test
sut:

View File

@ -4,7 +4,7 @@ services:
expose:
- "81"
environment:
WEB_PORTS: 81
WEB_PORTS: "81"
VIRTUAL_HOST: webA.nginx-proxy.tld,webB.nginx-proxy.tld
sut:

View File

@ -21,6 +21,5 @@ def test_multipath(docker_compose, nginxproxy):
assert r.text == "answer from port 83\n"
cfg = nginxproxy.get_conf().decode()
lines = cfg.splitlines()
web3_server_lines = [l for l in lines
if re.search(r'(?m)^\s*server\s+[^\s]*:83;\s*$', l)]
web3_server_lines = [l for l in lines if re.search(r'(?m)^\s*server\s+\S*:83;\s*$', l)]
assert len(web3_server_lines) == 1

View File

@ -20,7 +20,7 @@ services:
expose:
- "81"
environment:
WEB_PORTS: 81
WEB_PORTS: "81"
VIRTUAL_HOST: web1.nginx-proxy.example
networks:
- net1
@ -30,7 +30,7 @@ services:
expose:
- "82"
environment:
WEB_PORTS: 82
WEB_PORTS: "82"
VIRTUAL_HOST: web2.nginx-proxy.example
networks:
- net2
@ -40,7 +40,7 @@ services:
expose:
- "83"
environment:
WEB_PORTS: 83
WEB_PORTS: "83"
VIRTUAL_HOST: web3.nginx-proxy.test
networks:
- net3a

View File

@ -11,7 +11,7 @@ services:
expose:
- "81"
environment:
WEB_PORTS: 81
WEB_PORTS: "81"
VIRTUAL_HOST: web1.nginx-proxy.tld
networks:
- net1
@ -21,7 +21,7 @@ services:
expose:
- "82"
environment:
WEB_PORTS: 82
WEB_PORTS: "82"
VIRTUAL_HOST: web2.nginx-proxy.tld
networks:
- net1

View File

@ -13,7 +13,7 @@ services:
expose:
- "81"
environment:
WEB_PORTS: 81
WEB_PORTS: "81"
VIRTUAL_HOST: "172.20.0.4"
networks:
net1:
@ -26,7 +26,7 @@ services:
expose:
- "82"
environment:
WEB_PORTS: 82
WEB_PORTS: "82"
VIRTUAL_HOST: "[fd00::4]"
networks:
net1:

View File

@ -4,7 +4,7 @@ services:
expose:
- "81"
environment:
WEB_PORTS: 81
WEB_PORTS: "81"
VIRTUAL_HOST: web.nginx-proxy.tld
web2:
@ -12,7 +12,7 @@ services:
expose:
- "82"
environment:
WEB_PORTS: 83
WEB_PORTS: "83"
VIRTUAL_HOST: web.nginx-proxy.tld
web3:
@ -20,7 +20,7 @@ services:
expose:
- "83"
environment:
WEB_PORTS: 83
WEB_PORTS: "83"
VIRTUAL_HOST: web.nginx-proxy.tld
network_mode: "none"

View File

@ -4,7 +4,7 @@ services:
expose:
- "81"
environment:
WEB_PORTS: 81
WEB_PORTS: "81"
VIRTUAL_HOST: web.nginx-proxy.tld
sut:

View File

@ -4,7 +4,7 @@ services:
expose:
- "81"
environment:
WEB_PORTS: 81
WEB_PORTS: "81"
VIRTUAL_HOST: web.nginx-proxy.tld
network_mode: "none"

View File

@ -4,7 +4,7 @@ services:
expose:
- "80"
environment:
WEB_PORTS: 80
WEB_PORTS: "80"
VIRTUAL_HOST: web.nginx-proxy.tld
HTTPS_METHOD: noredirect

View File

@ -4,7 +4,7 @@ services:
expose:
- "80"
environment:
WEB_PORTS: 80
WEB_PORTS: "80"
VIRTUAL_HOST: web.nginx-proxy.tld
HTTPS_METHOD: noredirect

View File

@ -4,7 +4,7 @@ services:
expose:
- "80"
environment:
WEB_PORTS: 80
WEB_PORTS: "80"
VIRTUAL_HOST: web.nginx-proxy.tld
HTTPS_METHOD: noredirect

View File

@ -18,7 +18,7 @@ services:
expose:
- 81
environment:
WEB_PORTS: 81
WEB_PORTS: "81"
VIRTUAL_HOST: webA.nginx-proxy
webB:
@ -28,5 +28,5 @@ services:
expose:
- 82
environment:
WEB_PORTS: 82
WEB_PORTS: "82"
VIRTUAL_HOST: webB.nginx-proxy

View File

@ -4,7 +4,7 @@ services:
expose:
- "80"
environment:
WEB_PORTS: 80
WEB_PORTS: "80"
VIRTUAL_HOST: web.nginx-proxy.tld
sut:

View File

@ -4,7 +4,7 @@ services:
expose:
- "80"
environment:
WEB_PORTS: 80
WEB_PORTS: "80"
VIRTUAL_HOST: web.nginx-proxy.tld
sut:

View File

@ -1,5 +1,5 @@
import logging
import time
from time import sleep
import pytest
@ -13,11 +13,11 @@ def test_nginx_config_remains_the_same_after_restart(docker_compose, nginxproxy)
"""
Restarts the Web container and returns nginx-proxy config after restart
"""
def get_conf_after_web_container_restart():
def get_conf_after_web_container_restart() -> bytes:
web_containers = docker_compose.containers.list(filters={"ancestor": "web:latest"})
assert len(web_containers) == 1
web_containers[0].restart()
time.sleep(3)
sleep(3)
return nginxproxy.get_conf()

View File

@ -16,7 +16,7 @@ services:
expose:
- "81"
environment:
WEB_PORTS: 81
WEB_PORTS: "81"
VIRTUAL_HOST: web1.nginx-proxy.example
networks:
- net1