mirror of
https://github.com/nginx-proxy/nginx-proxy
synced 2024-05-10 01:26:08 +02:00
tests: predictable upstream names
This commit is contained in:
parent
ded3cfc168
commit
d10531e925
|
@ -0,0 +1,7 @@
|
|||
import pytest
|
||||
import re
|
||||
|
||||
|
||||
def test_predictable_upstream_is_present_in_nginx_generated_conf(docker_compose, nginxproxy):
|
||||
conf = nginxproxy.get_conf().decode('ASCII')
|
||||
assert re.search(r"upstream web\.nginx-proxy\.tld \{", conf)
|
|
@ -0,0 +1,16 @@
|
|||
version: '2'
|
||||
|
||||
services:
|
||||
web:
|
||||
image: web
|
||||
expose:
|
||||
- "80"
|
||||
environment:
|
||||
WEB_PORTS: 80
|
||||
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
|
|
@ -0,0 +1,12 @@
|
|||
import pytest
|
||||
import re
|
||||
|
||||
|
||||
def test_sha1_upstream_is_present_in_nginx_generated_conf(docker_compose, nginxproxy):
|
||||
conf = nginxproxy.get_conf().decode('ASCII')
|
||||
assert re.search(r"upstream 3e837201a6255962094cd6d8f61e22b07d3cc8ed \{", conf)
|
||||
|
||||
def test_sha1_upstream_forwards_correctly(docker_compose, nginxproxy):
|
||||
r = nginxproxy.get("http://web.nginx-proxy.tld/port")
|
||||
assert r.status_code == 200
|
||||
assert r.text == "answer from port 80\n"
|
|
@ -0,0 +1,18 @@
|
|||
version: '2'
|
||||
|
||||
services:
|
||||
web:
|
||||
image: web
|
||||
expose:
|
||||
- "80"
|
||||
environment:
|
||||
WEB_PORTS: 80
|
||||
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
|
||||
environment:
|
||||
SHA1_UPSTREAM_NAME: "true"
|
Loading…
Reference in New Issue