summaryrefslogtreecommitdiffstats
path: root/nixos/tests/syncthing/relay.nix
blob: e43f2e58f5ef4d40d8fe513749eee6f3e5a66b98 (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
{ lib, pkgs, ... }:
{
  name = "syncthing-relay";
  meta.maintainers = [ ];

  nodes.machine = {
    environment.systemPackages = [ pkgs.jq ];
    services.syncthing.relay = {
      enable = true;
      providedBy = "nixos-test";
      pools = [ ]; # Don't connect to any pool while testing.
      port = 12345;
      statusPort = 12346;
    };
  };

  testScript = ''
    machine.wait_for_unit("syncthing-relay.service")
    machine.wait_for_open_port(12345)
    machine.wait_for_open_port(12346)

    out = machine.succeed(
        "curl -sSf http://localhost:12346/status | jq -r '.options.\"provided-by\"'"
    )
    assert "nixos-test" in out
  '';
}