nixpkgs/nixos/tests/deluge.nix

108 lines
2.8 KiB
Nix
Raw Normal View History

2019-11-09 18:09:51 +00:00
import ./make-test-python.nix ({ pkgs, ...} : {
2018-01-10 00:52:15 +00:00
name = "deluge";
meta = with pkgs.stdenv.lib.maintainers; {
maintainers = [ flokli ];
};
nodes = {
2020-03-19 02:19:26 +00:00
simple1 = {
services.deluge = {
enable = true;
2020-03-19 02:19:26 +00:00
package = pkgs.deluge-1_x;
web = {
enable = true;
openFirewall = true;
};
};
};
2020-03-19 02:19:26 +00:00
declarative1 = {
services.deluge = {
enable = true;
package = pkgs.deluge-1_x;
openFirewall = true;
declarative = true;
config = {
allow_remote = true;
download_location = "/var/lib/deluge/my-download";
daemon_port = 58846;
listen_ports = [ 6881 6889 ];
};
web = {
enable = true;
port = 3142;
};
authFile = pkgs.writeText "deluge-auth" ''
localclient:a7bef72a890:10
andrew:password:10
user3:anotherpass:5
'';
};
};
2018-01-10 00:52:15 +00:00
2020-03-19 02:19:26 +00:00
simple2 = {
services.deluge = {
enable = true;
package = pkgs.deluge-2_x;
web = {
2018-01-10 00:52:15 +00:00
enable = true;
openFirewall = true;
2018-01-10 00:52:15 +00:00
};
};
2020-03-19 02:19:26 +00:00
};
declarative2 = {
services.deluge = {
enable = true;
package = pkgs.deluge-2_x;
openFirewall = true;
declarative = true;
config = {
allow_remote = true;
download_location = "/var/lib/deluge/my-download";
daemon_port = 58846;
listen_ports = [ 6881 6889 ];
};
web = {
enable = true;
port = 3142;
};
authFile = pkgs.writeText "deluge-auth" ''
localclient:a7bef72a890:10
andrew:password:10
user3:anotherpass:5
'';
};
};
2018-01-10 00:52:15 +00:00
};
testScript = ''
2019-11-09 18:09:51 +00:00
start_all()
2018-01-10 00:52:15 +00:00
2020-03-19 02:19:26 +00:00
simple1.wait_for_unit("deluged")
simple2.wait_for_unit("deluged")
simple1.wait_for_unit("delugeweb")
simple2.wait_for_unit("delugeweb")
simple1.wait_for_open_port("8112")
simple2.wait_for_open_port("8112")
declarative1.wait_for_unit("network.target")
declarative2.wait_for_unit("network.target")
declarative1.wait_until_succeeds("curl --fail http://simple1:8112")
declarative2.wait_until_succeeds("curl --fail http://simple2:8112")
2020-03-19 02:19:26 +00:00
declarative1.wait_for_unit("deluged")
declarative2.wait_for_unit("deluged")
declarative1.wait_for_unit("delugeweb")
declarative2.wait_for_unit("delugeweb")
declarative1.wait_until_succeeds("curl --fail http://declarative1:3142")
declarative2.wait_until_succeeds("curl --fail http://declarative2:3142")
declarative1.succeed(
"deluge-console 'connect 127.0.0.1:58846 andrew password; help' | grep -q 'rm.*Remove a torrent'"
)
declarative2.succeed(
"deluge-console 'connect 127.0.0.1:58846 andrew password; help' | grep -q 'rm.*Remove a torrent'"
2019-11-09 18:09:51 +00:00
)
2018-01-10 00:52:15 +00:00
'';
})