summaryrefslogtreecommitdiffstats
path: root/nixos/tests/suwayomi-server.nix
blob: 4be4cf273c38941bdd8074b2ea018156b10112a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
{ lib, runTest }:

let
  inherit (lib) recursiveUpdate;

  baseTestConfig = {
    meta.maintainers = with lib.maintainers; [ ratcornu ];
    nodes.machine =
      { pkgs, ... }:
      {
        services.suwayomi-server = {
          enable = true;
          settings.server.port = 1234;
        };
      };
  };
in

{
  without-auth = runTest (
    recursiveUpdate baseTestConfig {
      name = "suwayomi-server-without-auth";

      testScript = ''
        machine.wait_for_unit("suwayomi-server.service")
        machine.wait_for_open_port(1234)
        machine.succeed("curl --fail http://localhost:1234/")
      '';
    }
  );

  with-auth = runTest (
    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";
            };
          };
        };

      testScript = ''
        machine.wait_for_unit("suwayomi-server.service")
        machine.wait_for_open_port(1234)
        machine.succeed("curl --fail -u alice:pass http://localhost:1234/")
      '';
    }
  );
}