2019-12-15 21:29:17 +03:00
|
|
|
import ./make-test-python.nix ({ pkgs, ...} : {
|
2019-04-22 15:06:33 +03:00
|
|
|
name = "nzbget";
|
2021-01-10 22:08:30 +03:00
|
|
|
meta = with pkgs.lib.maintainers; {
|
2019-04-22 15:06:33 +03:00
|
|
|
maintainers = [ aanderse flokli ];
|
|
|
|
};
|
|
|
|
|
|
|
|
nodes = {
|
|
|
|
server = { ... }: {
|
|
|
|
services.nzbget.enable = true;
|
|
|
|
|
2021-08-03 17:44:20 +03:00
|
|
|
# provide some test settings
|
|
|
|
services.nzbget.settings = {
|
|
|
|
"MainDir" = "/var/lib/nzbget";
|
|
|
|
"DirectRename" = true;
|
|
|
|
"DiskSpace" = 0;
|
|
|
|
"Server1.Name" = "this is a test";
|
|
|
|
};
|
|
|
|
|
2019-04-22 15:06:33 +03:00
|
|
|
# hack, don't add (unfree) unrar to nzbget's path,
|
|
|
|
# so we can run this test in CI
|
2021-01-10 22:08:30 +03:00
|
|
|
systemd.services.nzbget.path = pkgs.lib.mkForce [ pkgs.p7zip ];
|
2019-04-22 15:06:33 +03:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2021-08-03 17:44:20 +03:00
|
|
|
testScript = { nodes, ... }: ''
|
2019-12-15 21:29:17 +03:00
|
|
|
start_all()
|
2019-04-22 15:06:33 +03:00
|
|
|
|
2019-12-15 21:29:17 +03:00
|
|
|
server.wait_for_unit("nzbget.service")
|
|
|
|
server.wait_for_unit("network.target")
|
|
|
|
server.wait_for_open_port(6789)
|
|
|
|
assert "This file is part of nzbget" in server.succeed(
|
2020-09-16 17:45:15 +03:00
|
|
|
"curl -f -s -u nzbget:tegbzn6789 http://127.0.0.1:6789"
|
2019-12-15 21:29:17 +03:00
|
|
|
)
|
|
|
|
server.succeed(
|
|
|
|
"${pkgs.nzbget}/bin/nzbget -n -o Control_iP=127.0.0.1 -o Control_port=6789 -o Control_password=tegbzn6789 -V"
|
|
|
|
)
|
2021-08-03 17:44:20 +03:00
|
|
|
|
2023-05-14 03:05:06 +03:00
|
|
|
config = server.succeed("${nodes.server.systemd.services.nzbget.serviceConfig.ExecStart} --printconfig")
|
2021-08-03 17:44:20 +03:00
|
|
|
|
|
|
|
# confirm the test settings are applied
|
|
|
|
assert 'MainDir = "/var/lib/nzbget"' in config
|
|
|
|
assert 'DirectRename = "yes"' in config
|
|
|
|
assert 'DiskSpace = "0"' in config
|
|
|
|
assert 'Server1.Name = "this is a test"' in config
|
2019-04-22 15:06:33 +03:00
|
|
|
'';
|
|
|
|
})
|