summaryrefslogtreecommitdiffstats
path: root/nixos/tests/polaris.nix
blob: 59e4b37337bfba709fd16ac6e01549031e68d688 (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
{ lib, ... }:

{
  name = "polaris";
  meta.maintainers = with lib.maintainers; [ pbsds ];

  nodes.machine =
    { pkgs, ... }:
    {
      environment.systemPackages = [ pkgs.jq ];
      services.polaris = {
        enable = true;
        port = 5050;
        settings.users = [
          {
            name = "test_user";
            password = "very_secret_password";
            admin = true;
          }
        ];
      };
    };

  testScript = ''
    machine.wait_for_unit("polaris.service")
    machine.wait_for_open_port(5050)
    machine.succeed("curl http://localhost:5050/api/version")
    machine.succeed("curl -X GET http://localhost:5050/api/initial_setup -H  'accept: application/json' | jq -e '.has_any_users == true'")
  '';
}