Skip to content

Commit

Permalink
nixosTests.caddy: Add test for multiple hostnames
Browse files Browse the repository at this point in the history
  • Loading branch information
lluchs committed Jan 7, 2025
1 parent 21a14a0 commit dacfe3f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions nixos/tests/caddy.nix
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ import ./make-test-python.nix (
"http://localhost:8081" = { };
};
};
specialisation.multiple-hostnames.configuration = {
services.caddy.virtualHosts = {
"http://localhost:8080 http://localhost:8081" = { };
};
};
specialisation.rfc42.configuration = {
services.caddy.settings = {
apps.http.servers.default = {
Expand Down Expand Up @@ -93,6 +98,7 @@ import ./make-test-python.nix (
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";
multipleHostnames = "${nodes.webserver.system.build.toplevel}/specialisation/multiple-hostnames";
rfc42Config = "${nodes.webserver.system.build.toplevel}/specialisation/rfc42";
withPluginsConfig = "${nodes.webserver.system.build.toplevel}/specialisation/with-plugins";
in
Expand All @@ -117,6 +123,13 @@ import ./make-test-python.nix (
webserver.wait_for_open_port(8080)
webserver.wait_for_open_port(8081)
with subtest("a virtual host with multiple hostnames works"):
webserver.succeed(
"${multipleHostnames}/bin/switch-to-configuration test >&2"
)
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"
Expand Down

0 comments on commit dacfe3f

Please sign in to comment.