sabnzbd: regression test for #504224
This commit is contained in:
@@ -1,12 +1,7 @@
|
||||
{ lib, ... }:
|
||||
{
|
||||
name = "sabnzbd";
|
||||
meta.maintainers = with lib.maintainers; [ jojosch ];
|
||||
|
||||
node.pkgsReadOnly = false;
|
||||
|
||||
nodes.machine =
|
||||
{ pkgs, lib, ... }:
|
||||
let
|
||||
common-config =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
services.sabnzbd = {
|
||||
enable = true;
|
||||
@@ -62,14 +57,78 @@
|
||||
# unrar is unfree
|
||||
nixpkgs.config.allowUnfreePackages = [ "unrar" ];
|
||||
};
|
||||
in
|
||||
{
|
||||
name = "sabnzbd";
|
||||
meta.maintainers = with lib.maintainers; [ jojosch ];
|
||||
|
||||
node.pkgsReadOnly = false;
|
||||
|
||||
nodes.machine =
|
||||
{ ... }:
|
||||
{
|
||||
imports = [ common-config ];
|
||||
};
|
||||
nodes.with_writeable_config =
|
||||
{ ... }:
|
||||
{
|
||||
imports = [ common-config ];
|
||||
config.services.sabnzbd.allowConfigWrite = true;
|
||||
};
|
||||
nodes.with_raw_config_file =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
imports = [ common-config ];
|
||||
config = {
|
||||
services.sabnzbd = {
|
||||
configFile = builtins.toFile "config.ini" ''
|
||||
[misc]
|
||||
inet_exposure = 2
|
||||
html_login = 0
|
||||
api_key = abcdef
|
||||
log_dir = /var/lib/sabnzbd
|
||||
admin_dir = /var/lib/sabnzbd
|
||||
'';
|
||||
};
|
||||
|
||||
environment.systemPackages = [
|
||||
pkgs.jq
|
||||
(pkgs.writeScriptBin "do_test_2" ''
|
||||
set -euxo pipefail
|
||||
|
||||
misc_url="http://127.0.0.1:8080/api?mode=get_config§ion=misc&output=json&apikey=abcdef"
|
||||
|
||||
[[ $(curl $misc_url | jq .config.misc.inet_exposure) == 2 ]]
|
||||
[[ $(curl $misc_url | jq .config.misc.html_login) == "false" ]]
|
||||
'')
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
|
||||
machine.wait_for_unit("sabnzbd.service")
|
||||
machine.wait_until_succeeds(
|
||||
"curl --fail -L http://localhost:8080/"
|
||||
)
|
||||
|
||||
machine.succeed("do_test")
|
||||
|
||||
|
||||
|
||||
with_writeable_config.wait_for_unit("sabnzbd.service")
|
||||
with_writeable_config.wait_until_succeeds(
|
||||
"curl --fail -L http://localhost:8080/"
|
||||
)
|
||||
|
||||
with_writeable_config.succeed("do_test")
|
||||
|
||||
|
||||
|
||||
with_raw_config_file.wait_for_unit("sabnzbd.service")
|
||||
with_raw_config_file.wait_until_succeeds(
|
||||
"curl --fail -L http://localhost:8080/"
|
||||
)
|
||||
|
||||
with_raw_config_file.succeed("do_test_2")
|
||||
'';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user