-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
nixos/tests/caddy: add pkgs.caddy.withPlugins test
- Loading branch information
Showing
1 changed file
with
31 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,12 +3,15 @@ import ./make-test-python.nix ( | |
{ | ||
name = "caddy"; | ||
meta = with pkgs.lib.maintainers; { | ||
maintainers = [ Br1ght0ne ]; | ||
maintainers = [ | ||
Br1ght0ne | ||
stepbrobd | ||
]; | ||
}; | ||
|
||
nodes = { | ||
webserver = | ||
{ pkgs, lib, ... }: | ||
{ pkgs, ... }: | ||
{ | ||
services.caddy.enable = true; | ||
services.caddy.extraConfig = '' | ||
|
@@ -63,6 +66,24 @@ import ./make-test-python.nix ( | |
respond "hello world" | ||
''; | ||
}; | ||
specialisation.with-plugins.configuration = { | ||
services.caddy = { | ||
package = pkgs.caddy.withPlugins { | ||
plugins = [ "github.com/caddyserver/[email protected]" ]; | ||
hash = "sha256-zgMdtOJbmtRSfTlrrg8njr11in2C7OAXLB+34V23jek="; | ||
}; | ||
configFile = pkgs.writeText "Caddyfile" '' | ||
{ | ||
order replace after encode | ||
} | ||
localhost:80 { | ||
respond "hello world" | ||
replace world caddy | ||
} | ||
''; | ||
}; | ||
}; | ||
}; | ||
}; | ||
|
||
|
@@ -73,6 +94,7 @@ import ./make-test-python.nix ( | |
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"; | ||
withPluginsConfig = "${nodes.webserver.system.build.toplevel}/specialisation/with-plugins"; | ||
in | ||
'' | ||
url = "http://localhost/example.html" | ||
|
@@ -108,6 +130,13 @@ import ./make-test-python.nix ( | |
) | ||
webserver.wait_for_open_port(80) | ||
webserver.succeed("curl http://localhost | grep hello") | ||
with subtest("plugins are correctled installed and configurable"): | ||
webserver.succeed( | ||
"${withPluginsConfig}/bin/switch-to-configuration test >&2" | ||
) | ||
webserver.wait_for_open_port(80) | ||
webserver.succeed("curl http://localhost | grep caddy") | ||
''; | ||
} | ||
) |