1 { system ? builtins.currentSystem
3 , pkgs ? import ../.. { inherit system config; }
7 inherit (import ../lib/testing-python.nix { inherit system pkgs; }) makeTest;
8 inherit (pkgs.lib) concatStringsSep maintainers mapAttrs mkMerge
9 removeSuffix splitString;
15 wait_for_unit("calibre-server.service")
20 libraries = [ "/var/lib/calibre-data" ];
23 succeed("ls -la /var/lib/calibre-data")
24 wait_for_unit("calibre-server.service")
29 libraries = [ "/var/lib/calibre-data" "/var/lib/calibre-server" ];
32 succeed("ls -la /var/lib/calibre-data")
33 succeed("ls -la /var/lib/calibre-server")
34 wait_for_unit("calibre-server.service")
43 wait_for_unit("calibre-server.service")
44 wait_for_open_port(8888)
45 succeed("curl --fail http://127.0.0.1:8888")
58 wait_for_unit("calibre-server.service")
59 wait_for_open_port(8888)
60 fail("curl --fail http://127.0.0.1:8888")
66 (test: testConfig: (makeTest (
68 nodeName = testConfig.nodeName or test;
71 libraries = [ "/var/lib/calibre-server" ];
72 } // testConfig.calibreConfig or {};
73 librariesInitScript = path: ''
74 ${nodeName}.execute("touch /tmp/test.epub")
75 ${nodeName}.execute("zip -r /tmp/test.zip /tmp/test.epub")
76 ${nodeName}.execute("mkdir -p ${path}")
77 ${nodeName}.execute("calibredb add -d --with-library ${path} /tmp/test.zip")
81 name = "calibre-server-${test}";
83 nodes.${nodeName} = mkMerge [{
84 environment.systemPackages = [ pkgs.zip ];
85 services.calibre-server = calibreConfig;
86 } testConfig.calibreProvider or { }];
90 ${concatStringsSep "\n" (map librariesInitScript calibreConfig.libraries)}
91 ${concatStringsSep "\n" (map (line:
92 if (builtins.substring 0 1 line == " " || builtins.substring 0 1 line == ")")
94 else "${nodeName}.${line}"
95 ) (splitString "\n" (removeSuffix "\n" testConfig.calibreScript)))}
96 ${nodeName}.shutdown()
99 meta = with maintainers; {
100 maintainers = [ gaelreyrol ];