test: separate containers (contd)

This commit is contained in:
Nicolas Duchon 2024-12-22 10:55:09 +01:00
parent 1430f9fbff
commit 209192e778
18 changed files with 389 additions and 32 deletions

View file

@ -1,3 +1,7 @@
volumes:
nginx_conf:
services:
keepalive-disabled:
image: web
@ -18,7 +22,7 @@ services:
VIRTUAL_HOST: keepalive-enabled.nginx-proxy.test
labels:
com.github.nginx-proxy.nginx-proxy.keepalive: "64"
keepalive-auto:
image: web
deploy:
@ -31,8 +35,30 @@ services:
VIRTUAL_HOST: keepalive-auto.nginx-proxy.test
sut:
profiles:
- singleContainer
image: nginxproxy/nginx-proxy:test
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
environment:
- &dockerSocket /var/run/docker.sock:/tmp/docker.sock:ro
environment: &nginxProxyEnv
HTTPS_METHOD: nohttps
sut-dockergen:
profiles:
- separateContainers
image: nginxproxy/nginx-proxy:test-dockergen
volumes:
- &confVolume nginx_conf:/etc/nginx/conf.d
- *dockerSocket
environment:
<<: *nginxProxyEnv
sut-nginx:
profiles:
- separateContainers
container_name: nginx-proxy
image: nginx:alpine
volumes:
- *confVolume
labels:
- "com.github.nginx-proxy.nginx-proxy.nginx"

View file

@ -1,3 +1,7 @@
volumes:
nginx_conf:
services:
loadbalance-hash:
image: web
@ -22,6 +26,26 @@ services:
replicas: 2
sut:
profiles:
- singleContainer
image: nginxproxy/nginx-proxy:test
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
- &dockerSocket /var/run/docker.sock:/tmp/docker.sock:ro
sut-dockergen:
profiles:
- separateContainers
image: nginxproxy/nginx-proxy:test-dockergen
volumes:
- &confVolume nginx_conf:/etc/nginx/conf.d
- *dockerSocket
sut-nginx:
profiles:
- separateContainers
container_name: nginx-proxy
image: nginx:alpine
volumes:
- *confVolume
labels:
- "com.github.nginx-proxy.nginx-proxy.nginx"

View file

@ -1,9 +1,35 @@
volumes:
nginx_conf:
services:
sut:
profiles:
- singleContainer
image: nginxproxy/nginx-proxy:test
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
- ./test_location-override.vhost.d:/etc/nginx/vhost.d:ro
- &dockerSocket /var/run/docker.sock:/tmp/docker.sock:ro
- &locationOverride ./test_location-override.vhost.d:/etc/nginx/vhost.d:ro
sut-dockergen:
profiles:
- separateContainers
image: nginxproxy/nginx-proxy:test-dockergen
volumes:
- &confVolume nginx_conf:/etc/nginx/conf.d
- *dockerSocket
- *locationOverride
sut-nginx:
profiles:
- separateContainers
container_name: nginx-proxy
image: nginx:alpine
volumes:
- *confVolume
- *locationOverride
labels:
- "com.github.nginx-proxy.nginx-proxy.nginx"
explicit-root:
image: web

View file

@ -4,7 +4,7 @@ def test_log_disabled(docker_compose, nginxproxy):
r = nginxproxy.get("http://nginx-proxy.test/port")
assert r.status_code == 200
assert r.text == "answer from port 81\n"
sut_container = docker_compose.containers.get("sut")
sut_container = docker_compose.containers.get("nginx-proxy")
docker_logs = sut_container.logs(stdout=True, stderr=True, stream=False, follow=False)
docker_logs = docker_logs.decode("utf-8").splitlines()
docker_logs = [line for line in docker_logs if "GET /port" in line]

View file

@ -1,3 +1,7 @@
volumes:
nginx_conf:
services:
web1:
image: web
@ -8,9 +12,31 @@ services:
VIRTUAL_HOST: nginx-proxy.test
sut:
container_name: sut
profiles:
- singleContainer
container_name: nginx-proxy
image: nginxproxy/nginx-proxy:test
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
environment:
- &dockerSocket /var/run/docker.sock:/tmp/docker.sock:ro
environment: &nginxProxyEnv
DISABLE_ACCESS_LOGS: true
sut-dockergen:
profiles:
- separateContainers
image: nginxproxy/nginx-proxy:test-dockergen
volumes:
- &confVolume nginx_conf:/etc/nginx/conf.d
- *dockerSocket
environment:
<<: *nginxProxyEnv
sut-nginx:
profiles:
- separateContainers
container_name: nginx-proxy
image: nginx:alpine
volumes:
- *confVolume
labels:
- "com.github.nginx-proxy.nginx-proxy.nginx"

View file

@ -4,7 +4,7 @@ def test_log_format(docker_compose, nginxproxy):
r = nginxproxy.get("http://nginx-proxy.test/port")
assert r.status_code == 200
assert r.text == "answer from port 81\n"
sut_container = docker_compose.containers.get("sut")
sut_container = docker_compose.containers.get("nginx-proxy")
docker_logs = sut_container.logs(stdout=True, stderr=True, stream=False, follow=False)
docker_logs = docker_logs.decode("utf-8").splitlines()
docker_logs = [line for line in docker_logs if "GET /port" in line]

View file

@ -1,3 +1,7 @@
volumes:
nginx_conf:
services:
web1:
image: web
@ -8,9 +12,31 @@ services:
VIRTUAL_HOST: nginx-proxy.test
sut:
container_name: sut
profiles:
- singleContainer
container_name: nginx-proxy
image: nginxproxy/nginx-proxy:test
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
environment:
- &dockerSocket /var/run/docker.sock:/tmp/docker.sock:ro
environment: &nginxProxyEnv
LOG_FORMAT: '$$remote_addr - $$remote_user [$$time_local] "$$request" $$status $$body_bytes_sent "$$http_referer" "$$http_user_agent" request_time=$$request_time $$upstream_response_time'
sut-dockergen:
profiles:
- separateContainers
image: nginxproxy/nginx-proxy:test-dockergen
volumes:
- &confVolume nginx_conf:/etc/nginx/conf.d
- *dockerSocket
environment:
<<: *nginxProxyEnv
sut-nginx:
profiles:
- separateContainers
container_name: nginx-proxy
image: nginx:alpine
volumes:
- *confVolume
labels:
- "com.github.nginx-proxy.nginx-proxy.nginx"

View file

@ -7,7 +7,7 @@ def test_log_json(docker_compose, nginxproxy):
r = nginxproxy.get("http://nginx-proxy.test/port")
assert r.status_code == 200
assert r.text == "answer from port 81\n"
sut_container = docker_compose.containers.get("sut")
sut_container = docker_compose.containers.get("nginx-proxy")
docker_logs = sut_container.logs(stdout=True, stderr=True, stream=False, follow=False)
docker_logs = docker_logs.decode("utf-8").splitlines()
docker_logs = [line for line in docker_logs if "{\"time_local\":" in line]

View file

@ -1,3 +1,7 @@
volumes:
nginx_conf:
services:
web1:
image: web
@ -8,9 +12,31 @@ services:
VIRTUAL_HOST: nginx-proxy.test
sut:
container_name: sut
profiles:
- singleContainer
container_name: nginx-proxy
image: nginxproxy/nginx-proxy:test
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
environment:
- &dockerSocket /var/run/docker.sock:/tmp/docker.sock:ro
environment: &nginxProxyEnv
LOG_JSON: 1
sut-dockergen:
profiles:
- separateContainers
image: nginxproxy/nginx-proxy:test-dockergen
volumes:
- &confVolume nginx_conf:/etc/nginx/conf.d
- *dockerSocket
environment:
<<: *nginxProxyEnv
sut-nginx:
profiles:
- separateContainers
container_name: nginx-proxy
image: nginx:alpine
volumes:
- *confVolume
labels:
- "com.github.nginx-proxy.nginx-proxy.nginx"

View file

@ -7,7 +7,7 @@ def test_log_json_format(docker_compose, nginxproxy):
r = nginxproxy.get("http://nginx-proxy.test/port")
assert r.status_code == 200
assert r.text == "answer from port 81\n"
sut_container = docker_compose.containers.get("sut")
sut_container = docker_compose.containers.get("nginx-proxy")
docker_logs = sut_container.logs(stdout=True, stderr=True, stream=False, follow=False)
docker_logs = docker_logs.decode("utf-8").splitlines()
docker_logs = [line for line in docker_logs if "{\"time_local\":" in line]

View file

@ -1,3 +1,7 @@
volumes:
nginx_conf:
services:
web1:
image: web
@ -8,9 +12,31 @@ services:
VIRTUAL_HOST: nginx-proxy.test
sut:
container_name: sut
profiles:
- singleContainer
container_name: nginx-proxy
image: nginxproxy/nginx-proxy:test
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
environment:
- &dockerSocket /var/run/docker.sock:/tmp/docker.sock:ro
environment: &nginxProxyEnv
LOG_FORMAT: '{"time_local":"$$time_iso8601","remote_addr":"$$remote_addr","request":"$$request","upstream_addr":"$$upstream_addr"}'
sut-dockergen:
profiles:
- separateContainers
image: nginxproxy/nginx-proxy:test-dockergen
volumes:
- &confVolume nginx_conf:/etc/nginx/conf.d
- *dockerSocket
environment:
<<: *nginxProxyEnv
sut-nginx:
profiles:
- separateContainers
container_name: nginx-proxy
image: nginx:alpine
volumes:
- *confVolume
labels:
- "com.github.nginx-proxy.nginx-proxy.nginx"

View file

@ -1,3 +1,7 @@
volumes:
nginx_conf:
services:
web:
image: web
@ -8,6 +12,26 @@ services:
VIRTUAL_HOST: webA.nginx-proxy.tld,webB.nginx-proxy.tld
sut:
profiles:
- singleContainer
image: nginxproxy/nginx-proxy:test
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
- &dockerSocket /var/run/docker.sock:/tmp/docker.sock:ro
sut-dockergen:
profiles:
- separateContainers
image: nginxproxy/nginx-proxy:test-dockergen
volumes:
- &confVolume nginx_conf:/etc/nginx/conf.d
- *dockerSocket
sut-nginx:
profiles:
- separateContainers
container_name: nginx-proxy
image: nginx:alpine
volumes:
- *confVolume
labels:
- "com.github.nginx-proxy.nginx-proxy.nginx"

View file

@ -4,17 +4,46 @@ networks:
net3a:
net3b:
volumes:
nginx_conf:
services:
nginx-proxy:
profiles:
- singleContainer
image: nginxproxy/nginx-proxy:test
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
networks:
- &dockerSocket /var/run/docker.sock:/tmp/docker.sock:ro
networks: &nginxProxyNetworks
- net1
- net2
- net3a
- net3b
nginx-proxy-dockergen:
profiles:
- separateContainers
image: nginxproxy/nginx-proxy:test-dockergen
volumes:
- &confVolume nginx_conf:/etc/nginx/conf.d
- *dockerSocket
networks:
<<: *nginxProxyNetworks
nginx-proxy-nginx:
profiles:
- separateContainers
container_name: nginx-proxy
image: nginx:alpine
volumes:
- *confVolume
labels:
- "com.github.nginx-proxy.nginx-proxy.nginx"
networks:
<<: *nginxProxyNetworks
web1:
image: web
expose:

View file

@ -1,3 +1,7 @@
volumes:
nginx_conf:
services:
skipvirtualhost:
image: web
@ -47,7 +51,7 @@ services:
}
}
}
virtualpath:
image: web
expose:
@ -70,6 +74,26 @@ services:
}
sut:
profiles:
- singleContainer
image: nginxproxy/nginx-proxy:test
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
- &dockerSocket /var/run/docker.sock:/tmp/docker.sock:ro
sut-dockergen:
profiles:
- separateContainers
image: nginxproxy/nginx-proxy:test-dockergen
volumes:
- &confVolume nginx_conf:/etc/nginx/conf.d
- *dockerSocket
sut-nginx:
profiles:
- separateContainers
container_name: nginx-proxy
image: nginx:alpine
volumes:
- *confVolume
labels:
- "com.github.nginx-proxy.nginx-proxy.nginx"

View file

@ -1,3 +1,7 @@
volumes:
nginx_conf:
services:
skipvirtualhost:
image: web
@ -36,7 +40,7 @@ services:
port9000.nginx-proxy.tld:
"/":
port: 9000
virtualpath:
image: web
expose:
@ -54,6 +58,26 @@ services:
dest: "/port"
sut:
profiles:
- singleContainer
image: nginxproxy/nginx-proxy:test
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
- &dockerSocket /var/run/docker.sock:/tmp/docker.sock:ro
sut-dockergen:
profiles:
- separateContainers
image: nginxproxy/nginx-proxy:test-dockergen
volumes:
- &confVolume nginx_conf:/etc/nginx/conf.d
- *dockerSocket
sut-nginx:
profiles:
- separateContainers
container_name: nginx-proxy
image: nginx:alpine
volumes:
- *confVolume
labels:
- "com.github.nginx-proxy.nginx-proxy.nginx"

View file

@ -1,3 +1,7 @@
volumes:
nginx_conf:
services:
invalidsyntax:
image: web
@ -37,6 +41,26 @@ services:
port: 9000
sut:
profiles:
- singleContainer
image: nginxproxy/nginx-proxy:test
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
- &dockerSocket /var/run/docker.sock:/tmp/docker.sock:ro
sut-dockergen:
profiles:
- separateContainers
image: nginxproxy/nginx-proxy:test-dockergen
volumes:
- &confVolume nginx_conf:/etc/nginx/conf.d
- *dockerSocket
sut-nginx:
profiles:
- separateContainers
container_name: nginx-proxy
image: nginx:alpine
volumes:
- *confVolume
labels:
- "com.github.nginx-proxy.nginx-proxy.nginx"

View file

@ -1,3 +1,7 @@
volumes:
nginx_conf:
services:
merged-singleport:
image: web
@ -34,6 +38,26 @@ services:
dest: "/"
sut:
profiles:
- singleContainer
image: nginxproxy/nginx-proxy:test
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
- &dockerSocket /var/run/docker.sock:/tmp/docker.sock:ro
sut-dockergen:
profiles:
- separateContainers
image: nginxproxy/nginx-proxy:test-dockergen
volumes:
- &confVolume nginx_conf:/etc/nginx/conf.d
- *dockerSocket
sut-nginx:
profiles:
- separateContainers
container_name: nginx-proxy
image: nginx:alpine
volumes:
- *confVolume
labels:
- "com.github.nginx-proxy.nginx-proxy.nginx"

View file

@ -5,6 +5,10 @@ networks:
config:
- subnet: fd00:1::/80
volumes:
nginx_conf:
services:
web1:
image: web
@ -27,8 +31,32 @@ services:
- net1
sut:
profiles:
- singleContainer
image: nginxproxy/nginx-proxy:test
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
- &dockerSocket /var/run/docker.sock:/tmp/docker.sock:ro
networks:
- net1
sut-dockergen:
profiles:
- separateContainers
image: nginxproxy/nginx-proxy:test-dockergen
volumes:
- &confVolume nginx_conf:/etc/nginx/conf.d
- *dockerSocket
networks:
- net1
sut-nginx:
profiles:
- separateContainers
container_name: nginx-proxy
image: nginx:alpine
volumes:
- *confVolume
networks:
- net1
labels:
- "com.github.nginx-proxy.nginx-proxy.nginx"