1{ lib, runTest }:
2
3let
4 inherit (lib) recursiveUpdate;
5
6 baseTestConfig = {
7 meta.maintainers = with lib.maintainers; [ ratcornu ];
8 nodes.machine =
9 { pkgs, ... }:
10 {
11 services.suwayomi-server = {
12 enable = true;
13 settings.server.port = 1234;
14 };
15 };
16 };
17in
18
19{
20 without-auth = runTest (
21 recursiveUpdate baseTestConfig {
22 name = "suwayomi-server-without-auth";
23
24 testScript = ''
25 machine.wait_for_unit("suwayomi-server.service")
26 machine.wait_for_open_port(1234)
27 machine.succeed("curl --fail http://localhost:1234/")
28 '';
29 }
30 );
31
32 with-auth = runTest (
33 recursiveUpdate baseTestConfig {
34 name = "suwayomi-server-with-auth";
35
36 nodes.machine =
37 { pkgs, ... }:
38 {
39 services.suwayomi-server = {
40 enable = true;
41
42 settings.server = {
43 port = 1234;
44 basicAuthEnabled = true;
45 basicAuthUsername = "alice";
46 basicAuthPasswordFile = pkgs.writeText "snakeoil-pass.txt" "pass";
47 };
48 };
49 };
50
51 testScript = ''
52 machine.wait_for_unit("suwayomi-server.service")
53 machine.wait_for_open_port(1234)
54 machine.succeed("curl --fail -u alice:pass http://localhost:1234/")
55 '';
56 }
57 );
58}