summaryrefslogtreecommitdiffstats
path: root/nixos/tests/realm.nix
blob: 353e595fbd3d0e7c341641328262a7ddb6df11d7 (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, pkgs, ... }:
{
  name = "realm";

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

  nodes.machine =
    { pkgs, ... }:
    {
      services.nginx = {
        enable = true;
        statusPage = true;
      };
      # realm need DNS resolv server to run or use config.dns.nameserver
      services.resolved.enable = true;

      services.realm = {
        enable = true;
        config = {
          endpoints = [
            {
              listen = "0.0.0.0:1000";
              remote = "127.0.0.1:80";
            }
          ];
        };
      };
    };

  testScript = ''
    machine.wait_for_unit("nginx.service")
    machine.wait_for_unit("realm.service")

    machine.wait_for_open_port(80)
    machine.wait_for_open_port(1000)

    machine.succeed("curl --fail http://localhost:1000/")
  '';

}