nginx-proxy-auto-docker/test/test_dockergen_v2/test_dockergen_v2.py
Thomas LEVEIL 5c2f50402a fix template when running docker-gen and nginx in separate containers
Since commit 658e20f, the template makes the assumption that the container running docker-gen is the container running nginx while checking that upstream containers are reachable.
By introducint the `NGINX_CONTAINER` environment variable, users are now able to indicate which container is actually running nginx when running docker-gen and nginx in separated containers.
2017-03-08 21:32:54 +01:00

18 lines
629 B
Python

from time import sleep
def test_nginx_is_running(nginx_tmpl, docker_compose):
sleep(3)
assert docker_compose.containers.get("nginx").status == "running"
def test_unknown_virtual_host_is_503(nginx_tmpl, docker_compose, nginxproxy):
r = nginxproxy.get("http://unknown.nginx.container.docker/")
assert r.status_code == 503
def test_forwards_to_whoami(nginx_tmpl, docker_compose, nginxproxy):
r = nginxproxy.get("http://whoami.nginx.container.docker/")
assert r.status_code == 200
whoami_container = docker_compose.containers.get("whoami")
assert r.text == "I'm %s\n" % whoami_container.id[:12]