about summary refs log tree commit diff
path: root/nixos/tests
diff options
context:
space:
mode:
authorsohalt <sohalt@sohalt.net>2023-12-06 21:34:38 +0100
committersohalt <sohalt@sohalt.net>2023-12-06 21:57:21 +0100
commit3c6b3d71fa696da5c170c0ff44eaa8c51999a80c (patch)
tree2ed4f7308f952f9f0c99d30f6340da2b9459a5a9 /nixos/tests
parentea5566eb3b278d405c7f2ecddae033ed2280ec8f (diff)
downloadnixlib-3c6b3d71fa696da5c170c0ff44eaa8c51999a80c.tar
nixlib-3c6b3d71fa696da5c170c0ff44eaa8c51999a80c.tar.gz
nixlib-3c6b3d71fa696da5c170c0ff44eaa8c51999a80c.tar.bz2
nixlib-3c6b3d71fa696da5c170c0ff44eaa8c51999a80c.tar.lz
nixlib-3c6b3d71fa696da5c170c0ff44eaa8c51999a80c.tar.xz
nixlib-3c6b3d71fa696da5c170c0ff44eaa8c51999a80c.tar.zst
nixlib-3c6b3d71fa696da5c170c0ff44eaa8c51999a80c.zip
nixos/caddy: Use caddyfile adapter by default when explicitly specifying configFile
Diffstat (limited to 'nixos/tests')
-rw-r--r--nixos/tests/caddy.nix15
1 files changed, 15 insertions, 0 deletions
diff --git a/nixos/tests/caddy.nix b/nixos/tests/caddy.nix
index 5a0d3539394b..41d8e57de468 100644
--- a/nixos/tests/caddy.nix
+++ b/nixos/tests/caddy.nix
@@ -48,11 +48,19 @@ import ./make-test-python.nix ({ pkgs, ... }: {
           };
         };
       };
+      specialisation.explicit-config-file.configuration = {
+        services.caddy.configFile = pkgs.writeText "Caddyfile" ''
+        localhost:80
+
+        respond "hello world"
+        '';
+      };
     };
   };
 
   testScript = { nodes, ... }:
     let
+      explicitConfigFile = "${nodes.webserver.system.build.toplevel}/specialisation/explicit-config-file";
       justReloadSystem = "${nodes.webserver.system.build.toplevel}/specialisation/config-reload";
       multipleConfigs = "${nodes.webserver.system.build.toplevel}/specialisation/multiple-configs";
       rfc42Config = "${nodes.webserver.system.build.toplevel}/specialisation/rfc42";
@@ -84,5 +92,12 @@ import ./make-test-python.nix ({ pkgs, ... }: {
           )
           webserver.wait_for_open_port(80)
           webserver.succeed("curl http://localhost | grep hello")
+
+      with subtest("explicit configFile"):
+          webserver.succeed(
+              "${explicitConfigFile}/bin/switch-to-configuration test >&2"
+          )
+          webserver.wait_for_open_port(80)
+          webserver.succeed("curl http://localhost | grep hello")
     '';
 })