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
committergithub-actions[bot] <github-actions[bot]@users.noreply.github.com>2023-12-07 07:08:04 +0000
commit70c3cde53b9e7ac85a4cb46032f661dfc5fb8adc (patch)
tree5128d2fe06f29ce8ec2469bcb0efdb915da3f65d /nixos/tests
parent1ed863a65c91f77e027955818bf6679f4c966320 (diff)
nixos/caddy: Use caddyfile adapter by default when explicitly specifying configFile
(cherry picked from commit 3c6b3d71fa696da5c170c0ff44eaa8c51999a80c)
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 5a0d3539394b6..41d8e57de4686 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")
     '';
 })