Parcourir la source

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..
polarathene il y a 3 ans
Parent
commit
41bd4076c0
1 fichiers modifiés avec 16 ajouts et 20 suppressions
  1. 16 20
      test/test_ssl/test_dhparam.yml

+ 16 - 20
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
+  image: *img-nginxproxy
+  volumes: *vols-common