nixosTests.calibre-{web,server}: migrate to runTest (#396377)

This commit is contained in:
Pol Dellaiera 2025-04-06 20:53:06 +02:00 committed by GitHub
commit bd0b4a43f7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 42 additions and 45 deletions

View File

@ -274,8 +274,8 @@ in
cadvisor = handleTestOn [ "x86_64-linux" ] ./cadvisor.nix { };
cage = handleTest ./cage.nix { };
cagebreak = handleTest ./cagebreak.nix { };
calibre-web = handleTest ./calibre-web.nix { };
calibre-server = handleTest ./calibre-server.nix { };
calibre-web = runTest ./calibre-web.nix;
calibre-server = import ./calibre-server.nix { inherit pkgs runTest; };
canaille = handleTest ./canaille.nix { };
castopod = handleTest ./castopod.nix { };
cassandra_3_0 = handleTest ./cassandra.nix { testPackage = pkgs.cassandra_3_0; };

View File

@ -1,11 +1,10 @@
{
system ? builtins.currentSystem,
config ? { },
pkgs ? import ../.. { inherit system config; },
pkgs,
runTest,
...
}:
let
inherit (import ../lib/testing-python.nix { inherit system pkgs; }) makeTest;
inherit (pkgs.lib)
concatStringsSep
maintainers
@ -74,7 +73,7 @@ let
in
mapAttrs (
test: testConfig:
(makeTest (
(runTest (
let
nodeName = testConfig.nodeName or test;
calibreConfig = {

View File

@ -1,44 +1,42 @@
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"
)
'';
}