2020-04-24 23:36:52 +00:00
|
|
|
import ./make-test-python.nix ({ pkgs, ...} : {
|
|
|
|
name = "deluge";
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with pkgs.lib.maintainers; {
|
2020-04-24 23:36:52 +00:00
|
|
|
maintainers = [ flokli ];
|
|
|
|
};
|
|
|
|
|
|
|
|
nodes = {
|
2021-12-06 16:07:01 +00:00
|
|
|
simple = {
|
2020-04-24 23:36:52 +00:00
|
|
|
services.deluge = {
|
|
|
|
enable = true;
|
|
|
|
package = pkgs.deluge-2_x;
|
|
|
|
web = {
|
|
|
|
enable = true;
|
|
|
|
openFirewall = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
declarative = {
|
2020-04-24 23:36:52 +00:00
|
|
|
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
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
testScript = ''
|
|
|
|
start_all()
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
simple.wait_for_unit("deluged")
|
|
|
|
simple.wait_for_unit("delugeweb")
|
2022-06-16 17:23:12 +00:00
|
|
|
simple.wait_for_open_port(8112)
|
2021-12-06 16:07:01 +00:00
|
|
|
declarative.wait_for_unit("network.target")
|
|
|
|
declarative.wait_until_succeeds("curl --fail http://simple:8112")
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
declarative.wait_for_unit("deluged")
|
|
|
|
declarative.wait_for_unit("delugeweb")
|
|
|
|
declarative.wait_until_succeeds("curl --fail http://declarative:3142")
|
2022-11-21 17:40:18 +00:00
|
|
|
|
|
|
|
# deluge-console always exits with 1. https://dev.deluge-torrent.org/ticket/3291
|
2021-12-06 16:07:01 +00:00
|
|
|
declarative.succeed(
|
2022-11-21 17:40:18 +00:00
|
|
|
"(deluge-console 'connect 127.0.0.1:58846 andrew password; help' || true) | grep -q 'rm.*Remove a torrent'"
|
2020-04-24 23:36:52 +00:00
|
|
|
)
|
|
|
|
'';
|
|
|
|
})
|