From d01d4303423e49de20008cba95b4a517d17e830a Mon Sep 17 00:00:00 2001 From: Jonathan Davies Date: Sat, 18 May 2024 10:35:20 +0100 Subject: [PATCH] nixos/step-ca: Added Caddy example to integration tests. --- nixos/tests/step-ca.nix | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/nixos/tests/step-ca.nix b/nixos/tests/step-ca.nix index a855b590232d..31ec0078e0f6 100644 --- a/nixos/tests/step-ca.nix +++ b/nixos/tests/step-ca.nix @@ -62,6 +62,24 @@ import ./make-test-python.nix ({ pkgs, ... }: }; }; + caclientcaddy = + { config, pkgs, ... }: { + security.pki.certificateFiles = [ "${test-certificates}/root_ca.crt" ]; + + networking.firewall.allowedTCPPorts = [ 80 443 ]; + + services.caddy = { + enable = true; + virtualHosts."caclientcaddy".extraConfig = '' + respond "Welcome to Caddy!" + + tls caddy@example.org { + ca https://caserver:8443/acme/acme/directory + } + ''; + }; + }; + catester = { config, pkgs, ... }: { security.pki.certificateFiles = [ "${test-certificates}/root_ca.crt" ]; }; @@ -73,5 +91,8 @@ import ./make-test-python.nix ({ pkgs, ... }: caserver.wait_for_unit("step-ca.service") caclient.wait_for_unit("acme-finished-caclient.target") catester.succeed("curl https://caclient/ | grep \"Welcome to nginx!\"") + + caclientcaddy.wait_for_unit("caddy.service") + catester.succeed("curl https://caclientcaddy/ | grep \"Welcome to Caddy!\"") ''; })