vuls: init at 0.27.0 (#348530)
[NixPkgs.git] / nixos / tests / deluge.nix
blobe8945fdea003aa1f665ae948261cb452be03dfda
1 import ./make-test-python.nix ({ pkgs, ...} : {
2   name = "deluge";
3   meta = with pkgs.lib.maintainers; {
4     maintainers = [ flokli ];
5   };
7   nodes = {
8     simple = {
9       services.deluge = {
10         enable = true;
11         package = pkgs.deluge-2_x;
12         web = {
13           enable = true;
14           openFirewall = true;
15         };
16       };
17     };
19     declarative = {
20       services.deluge = {
21         enable = true;
22         package = pkgs.deluge-2_x;
23         openFirewall = true;
24         declarative = true;
25         config = {
26           allow_remote = true;
27           download_location = "/var/lib/deluge/my-download";
28           daemon_port = 58846;
29           listen_ports = [ 6881 6889 ];
30         };
31         web = {
32           enable = true;
33           port =  3142;
34         };
35         authFile = pkgs.writeText "deluge-auth" ''
36           localclient:a7bef72a890:10
37           andrew:password:10
38           user3:anotherpass:5
39         '';
40       };
41     };
43   };
45   testScript = ''
46     start_all()
48     simple.wait_for_unit("deluged")
49     simple.wait_for_unit("delugeweb")
50     simple.wait_for_open_port(8112)
51     declarative.wait_for_unit("network.target")
52     declarative.wait_until_succeeds("curl --fail http://simple:8112")
54     declarative.wait_for_unit("deluged")
55     declarative.wait_for_unit("delugeweb")
56     declarative.wait_until_succeeds("curl --fail http://declarative:3142")
58     # deluge-console always exits with 1. https://dev.deluge-torrent.org/ticket/3291
59     declarative.succeed(
60         "(deluge-console 'connect 127.0.0.1:58846 andrew password; help' || true) | grep -q 'rm.*Remove a torrent'"
61     )
62   '';