nixos/suwayomi-server: add nixos tests

This commit is contained in:
RatCornu 2024-01-18 22:11:16 +01:00
parent 4133bb1bb0
commit 279057b779
No known key found for this signature in database
GPG Key ID: B3BE02E379E6E8E2
3 changed files with 53 additions and 0 deletions

View File

@ -808,6 +808,7 @@ in {
stunnel = handleTest ./stunnel.nix {};
sudo = handleTest ./sudo.nix {};
sudo-rs = handleTest ./sudo-rs.nix {};
suwayomi-server = handleTest ./suwayomi-server.nix {};
swap-file-btrfs = handleTest ./swap-file-btrfs.nix {};
swap-partition = handleTest ./swap-partition.nix {};
swap-random-encryption = handleTest ./swap-random-encryption.nix {};

View File

@ -0,0 +1,46 @@
{ system ? builtins.currentSystem
, pkgs
, lib ? pkgs.lib
}:
let
inherit (import ../lib/testing-python.nix { inherit system pkgs; }) makeTest;
inherit (lib) recursiveUpdate;
baseTestConfig = {
meta.maintainers = with lib.maintainers; [ ratcornu ];
nodes.machine = { pkgs, ... }: {
services.suwayomi-server = {
enable = true;
settings.server.port = 1234;
};
};
testScript = ''
machine.wait_for_unit("suwayomi-server.service")
machine.wait_for_open_port(1234)
machine.succeed("curl --fail http://localhost:1234/")
'';
};
in
{
without-auth = makeTest (recursiveUpdate baseTestConfig {
name = "suwayomi-server-without-auth";
});
with-auth = makeTest (recursiveUpdate baseTestConfig {
name = "suwayomi-server-with-auth";
nodes.machine = { pkgs, ... }: {
services.suwayomi-server = {
enable = true;
settings.server = {
port = 1234;
basicAuthEnabled = true;
basicAuthUsername = "alice";
basicAuthPasswordFile = pkgs.writeText "snakeoil-pass.txt" "pass";
};
};
};
});
}

View File

@ -3,6 +3,7 @@
, fetchurl
, makeWrapper
, jdk17_headless
, nixosTests
}:
let
@ -34,6 +35,11 @@ stdenvNoCC.mkDerivation (finalAttrs: {
runHook postBuild
'';
passthru.tests = {
suwayomi-server-with-auth = nixosTests.suwayomi-server.with-auth;
suwayomi-server-without-auth = nixosTests.suwayomi-server.without-auth;
};
meta = with lib; {
description = "A free and open source manga reader server that runs extensions built for Tachiyomi.";
longDescription = ''