From 41bd4076c09ce23ea8d55e566ee4588d9c3847aa Mon Sep 17 00:00:00 2001 From: polarathene <5098581+polarathene@users.noreply.github.com> Date: Wed, 29 Sep 2021 15:19:38 +1300 Subject: [PATCH] chore: DRY up `test_dhparam.yml` Use YAML anchors for repeated values providing a single source of truth. I would use `x-*` convention to store anchors above service containers, but this seems to require a compose config that defines the services (and version?) keys, which this test setup was failing to be compatible with for some reason.. --- test/test_ssl/test_dhparam.yml | 36 +++++++++++++++------------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/test/test_ssl/test_dhparam.yml b/test/test_ssl/test_dhparam.yml index 8906937..6673f18 100644 --- a/test/test_ssl/test_dhparam.yml +++ b/test/test_ssl/test_dhparam.yml @@ -7,44 +7,40 @@ web5: VIRTUAL_HOST: "web5.nginx-proxy.tld" # sut - System Under Test +# `docker.sock` required for functionality +# `certs` required to enable HTTPS via template with_default_group: - image: nginxproxy/nginx-proxy:test container_name: dh-default - volumes: - - /var/run/docker.sock:/tmp/docker.sock:ro - - ./certs:/etc/nginx/certs:ro + image: &img-nginxproxy nginxproxy/nginx-proxy:test + volumes: &vols-common + - &docker-sock /var/run/docker.sock:/tmp/docker.sock:ro + - &nginx-certs ./certs:/etc/nginx/certs:ro with_alternative_group: - image: nginxproxy/nginx-proxy:test container_name: dh-env environment: - DHPARAM_BITS=2048 - volumes: - - /var/run/docker.sock:/tmp/docker.sock:ro - - ./certs:/etc/nginx/certs:ro + image: *img-nginxproxy + volumes: *vols-common with_invalid_group: - image: nginxproxy/nginx-proxy:test container_name: invalid-group-1024 environment: - DHPARAM_BITS=1024 - volumes: - - /var/run/docker.sock:/tmp/docker.sock:ro - - ./certs:/etc/nginx/certs:ro + image: *img-nginxproxy + volumes: *vols-common with_custom_file: - image: nginxproxy/nginx-proxy:test container_name: dh-file - volumes: - - /var/run/docker.sock:/tmp/docker.sock:ro - - ./certs:/etc/nginx/certs:ro + image: *img-nginxproxy + volumes: + - *docker-sock + - *nginx-certs - ../lib/ssl/dhparam.pem:/etc/nginx/dhparam/dhparam.pem:ro with_skip: - image: nginxproxy/nginx-proxy:test container_name: dh-skip environment: - DHPARAM_SKIP=1 - volumes: - - /var/run/docker.sock:/tmp/docker.sock:ro - - ./certs:/etc/nginx/certs:ro \ No newline at end of file + image: *img-nginxproxy + volumes: *vols-common \ No newline at end of file