summary refs log tree commit diff
path: root/nixos/tests/caddy.nix
diff options
context:
space:
mode:
authorEmily <git@emilylange.de>2023-08-23 20:36:46 +0200
committerGitHub <noreply@github.com>2023-08-23 20:36:46 +0200
commit73a060e7ca83c41f63ab0016584c95bacb4a7aad (patch)
tree4222f9027e07a5df888bf9561d20dafd913160ef /nixos/tests/caddy.nix
parent36d3534f3eced009f2c9f9635a33681aa80e0b7b (diff)
parentc01874615be331a9f2832488ac56515bf1804197 (diff)
downloadnixpkgs-73a060e7ca83c41f63ab0016584c95bacb4a7aad.tar
nixpkgs-73a060e7ca83c41f63ab0016584c95bacb4a7aad.tar.gz
nixpkgs-73a060e7ca83c41f63ab0016584c95bacb4a7aad.tar.bz2
nixpkgs-73a060e7ca83c41f63ab0016584c95bacb4a7aad.tar.lz
nixpkgs-73a060e7ca83c41f63ab0016584c95bacb4a7aad.tar.xz
nixpkgs-73a060e7ca83c41f63ab0016584c95bacb4a7aad.tar.zst
nixpkgs-73a060e7ca83c41f63ab0016584c95bacb4a7aad.zip
Merge pull request #244626 from Sohalt/caddy-rfc42
nixos/caddy: Add rfc42 settings option
Diffstat (limited to 'nixos/tests/caddy.nix')
-rw-r--r--nixos/tests/caddy.nix22
1 files changed, 22 insertions, 0 deletions
diff --git a/nixos/tests/caddy.nix b/nixos/tests/caddy.nix
index 238091ec606..5a0d3539394 100644
--- a/nixos/tests/caddy.nix
+++ b/nixos/tests/caddy.nix
@@ -34,6 +34,20 @@ import ./make-test-python.nix ({ pkgs, ... }: {
           "http://localhost:8081" = { };
         };
       };
+      specialisation.rfc42.configuration = {
+        services.caddy.settings = {
+          apps.http.servers.default = {
+            listen = [ ":80" ];
+            routes = [{
+              handle = [{
+                body = "hello world";
+                handler = "static_response";
+                status_code = 200;
+              }];
+            }];
+          };
+        };
+      };
     };
   };
 
@@ -41,6 +55,7 @@ import ./make-test-python.nix ({ pkgs, ... }: {
     let
       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";
     in
     ''
       url = "http://localhost/example.html"
@@ -62,5 +77,12 @@ import ./make-test-python.nix ({ pkgs, ... }: {
           )
           webserver.wait_for_open_port(8080)
           webserver.wait_for_open_port(8081)
+
+      with subtest("rfc42 settings config"):
+          webserver.succeed(
+              "${rfc42Config}/bin/switch-to-configuration test >&2"
+          )
+          webserver.wait_for_open_port(80)
+          webserver.succeed("curl http://localhost | grep hello")
     '';
 })