summaryrefslogtreecommitdiffstats
path: root/nixos/tests/web-apps/linkding-postgres.nix
blob: 486e8de653b3da62ddfecc63c4dd2a5f71ac60f8 (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
{ lib, ... }:
{
  name = "linkding-postgres";

  meta = {
    maintainers = with lib.maintainers; [ squat ];
  };

  nodes.machine =
    { ... }:
    {
      services.linkding = {
        enable = true;
        port = 9090;
        database = {
          createLocally = true;
          type = "postgres";
        };
      };
    };

  testScript = ''
    machine.start()
    machine.wait_for_unit("linkding.service")
    machine.wait_for_open_port(9090)

    with subtest("Login page loads"):
        machine.succeed(
            "curl -sSfL http://127.0.0.1:9090 | grep -i 'linkding'"
        )

    with subtest("Health endpoint responds"):
        machine.succeed(
            "curl -sSf http://127.0.0.1:9090/health"
        )

    with subtest("linkding-manage works"):
        machine.succeed(
            "linkding-manage version"
        )
  '';
}