nixosTests.calibre-web: migrate to runTest

Part of #386873

Changed files
+37 -39
nixos
+1 -1
nixos/tests/all-tests.nix
···
cadvisor = handleTestOn [ "x86_64-linux" ] ./cadvisor.nix { };
cage = handleTest ./cage.nix { };
cagebreak = handleTest ./cagebreak.nix { };
-
calibre-web = handleTest ./calibre-web.nix { };
+
calibre-web = runTest ./calibre-web.nix;
calibre-server = handleTest ./calibre-server.nix { };
canaille = handleTest ./canaille.nix { };
castopod = handleTest ./castopod.nix { };
+36 -38
nixos/tests/calibre-web.nix
···
-
import ./make-test-python.nix (
-
{ pkgs, lib, ... }:
+
{ lib, ... }:
-
let
-
port = 3142;
-
defaultPort = 8083;
-
in
-
{
-
name = "calibre-web";
-
meta.maintainers = with lib.maintainers; [ pborzenkov ];
+
let
+
port = 3142;
+
defaultPort = 8083;
+
in
+
{
+
name = "calibre-web";
+
meta.maintainers = with lib.maintainers; [ pborzenkov ];
-
nodes = {
-
customized =
-
{ pkgs, ... }:
-
{
-
services.calibre-web = {
-
enable = true;
-
listen.port = port;
-
options = {
-
calibreLibrary = "/tmp/books";
-
reverseProxyAuth = {
-
enable = true;
-
header = "X-User";
-
};
+
nodes = {
+
customized =
+
{ pkgs, ... }:
+
{
+
services.calibre-web = {
+
enable = true;
+
listen.port = port;
+
options = {
+
calibreLibrary = "/tmp/books";
+
reverseProxyAuth = {
+
enable = true;
+
header = "X-User";
};
};
-
environment.systemPackages = [ pkgs.calibre ];
};
-
};
-
testScript = ''
-
start_all()
+
environment.systemPackages = [ pkgs.calibre ];
+
};
+
};
+
testScript = ''
+
start_all()
-
customized.succeed(
-
"mkdir /tmp/books && calibredb --library-path /tmp/books add -e --title test-book"
-
)
-
customized.succeed("systemctl restart calibre-web")
-
customized.wait_for_unit("calibre-web.service")
-
customized.wait_for_open_port(${toString port})
-
customized.succeed(
-
"curl --fail -H X-User:admin 'http://localhost:${toString port}' | grep test-book"
-
)
-
'';
-
}
-
)
+
customized.succeed(
+
"mkdir /tmp/books && calibredb --library-path /tmp/books add -e --title test-book"
+
)
+
customized.succeed("systemctl restart calibre-web")
+
customized.wait_for_unit("calibre-web.service")
+
customized.wait_for_open_port(${toString port})
+
customized.succeed(
+
"curl --fail -H X-User:admin 'http://localhost:${toString port}' | grep test-book"
+
)
+
'';
+
}