Skip to content

Commit dacfe3f

Browse files
committed
nixosTests.caddy: Add test for multiple hostnames
1 parent 21a14a0 commit dacfe3f

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

nixos/tests/caddy.nix

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ import ./make-test-python.nix (
4141
"http://localhost:8081" = { };
4242
};
4343
};
44+
specialisation.multiple-hostnames.configuration = {
45+
services.caddy.virtualHosts = {
46+
"http://localhost:8080 http://localhost:8081" = { };
47+
};
48+
};
4449
specialisation.rfc42.configuration = {
4550
services.caddy.settings = {
4651
apps.http.servers.default = {
@@ -93,6 +98,7 @@ import ./make-test-python.nix (
9398
explicitConfigFile = "${nodes.webserver.system.build.toplevel}/specialisation/explicit-config-file";
9499
justReloadSystem = "${nodes.webserver.system.build.toplevel}/specialisation/config-reload";
95100
multipleConfigs = "${nodes.webserver.system.build.toplevel}/specialisation/multiple-configs";
101+
multipleHostnames = "${nodes.webserver.system.build.toplevel}/specialisation/multiple-hostnames";
96102
rfc42Config = "${nodes.webserver.system.build.toplevel}/specialisation/rfc42";
97103
withPluginsConfig = "${nodes.webserver.system.build.toplevel}/specialisation/with-plugins";
98104
in
@@ -117,6 +123,13 @@ import ./make-test-python.nix (
117123
webserver.wait_for_open_port(8080)
118124
webserver.wait_for_open_port(8081)
119125
126+
with subtest("a virtual host with multiple hostnames works"):
127+
webserver.succeed(
128+
"${multipleHostnames}/bin/switch-to-configuration test >&2"
129+
)
130+
webserver.wait_for_open_port(8080)
131+
webserver.wait_for_open_port(8081)
132+
120133
with subtest("rfc42 settings config"):
121134
webserver.succeed(
122135
"${rfc42Config}/bin/switch-to-configuration test >&2"

0 commit comments

Comments
 (0)