0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-13 13:40:28 +03:00

caddy: withPlugins better error messages for untagged plugins (#368657)

This commit is contained in:
Thiago Kenji Okada 2024-12-29 12:32:21 +00:00 committed by GitHub
commit b821685bc8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 101 additions and 19 deletions

View file

@ -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/replace-response@v0.0.0-20241211194404-3865845790a7" ];
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")
'';
}
)