nixpkgs/nixos/tests/prowlarr.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

41 lines
1.5 KiB
Nix
Raw Permalink Normal View History

{ lib, config, ... }:
2021-10-10 08:54:22 -07:00
{
name = "prowlarr";
meta.maintainers = with lib.maintainers; [ ];
2021-10-10 08:54:22 -07:00
nodes.machine =
{ pkgs, ... }:
{
services.prowlarr.enable = true;
specialisation.customDataDir = {
inheritParentConfig = true;
configuration.services.prowlarr.dataDir = "/srv/prowlarr";
2021-10-10 08:54:22 -07:00
};
};
2021-10-10 08:54:22 -07:00
testScript = ''
def verify_prowlarr_works():
2021-10-10 08:54:22 -07:00
machine.wait_for_unit("prowlarr.service")
machine.wait_for_open_port(9696)
response = machine.succeed("curl --fail http://localhost:9696/")
assert '<title>Prowlarr</title>' in response, "Login page didn't load successfully"
machine.succeed("[ -d /var/lib/prowlarr ]")
with subtest("Prowlarr starts and responds to requests"):
verify_prowlarr_works()
with subtest("Prowlarr data directory migration works"):
machine.systemctl("stop prowlarr.service")
machine.succeed("mkdir -p /tmp/prowlarr-migration")
machine.succeed("mv /var/lib/prowlarr/* /tmp/prowlarr-migration")
machine.succeed("${config.nodes.machine.system.build.toplevel}/specialisation/customDataDir/bin/switch-to-configuration test")
machine.wait_for_unit("var-lib-private-prowlarr.mount")
machine.succeed("mv /tmp/prowlarr-migration/* /var/lib/prowlarr")
machine.systemctl("restart prowlarr.service")
# Check that we're using a bind mount when using a non-default dataDir
machine.succeed("findmnt /var/lib/private/prowlarr | grep /srv/prowlarr")
verify_prowlarr_works()
'';
}