summaryrefslogtreecommitdiffstats
path: root/nixos/tests/web-apps/gotosocial.nix
blob: bf74bcf09887a290f90b03ff735b2edbee9fdbdf (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
{ lib, ... }:
{
  name = "gotosocial";
  meta.maintainers = with lib.maintainers; [ blakesmith ];

  containers.machine =
    { pkgs, ... }:
    {
      environment.systemPackages = [ pkgs.jq ];
      services.gotosocial = {
        enable = true;
        setupPostgresqlDB = true;
        settings = {
          host = "localhost:8081";
          port = 8081;
          instance-stats-mode = "serve";
        };
      };
    };

  testScript = ''
    machine.wait_for_unit("gotosocial.service")
    machine.wait_for_unit("postgresql.target")
    machine.wait_for_open_port(8081)
    # Database migrations are running, wait until gotosocial no longer serves 503
    machine.wait_until_succeeds("curl -sS -f http://localhost:8081/readyz", timeout=300)

    # check user registration via cli
    machine.succeed("gotosocial-admin account create --username nickname --email email@example.com --password kurtz575VPeBgjVm")
    machine.wait_until_succeeds("curl -sS -f http://localhost:8081/nodeinfo/2.0 | jq '.usage.users.total' | grep -q '^1$'")
  '';
}