1{ lib, pkgs, ... }:
2{
3 name = "syncthing-relay";
4 meta.maintainers = with pkgs.lib.maintainers; [ ];
5
6 nodes.machine = {
7 environment.systemPackages = [ pkgs.jq ];
8 services.syncthing.relay = {
9 enable = true;
10 providedBy = "nixos-test";
11 pools = [ ]; # Don't connect to any pool while testing.
12 port = 12345;
13 statusPort = 12346;
14 };
15 };
16
17 testScript = ''
18 machine.wait_for_unit("syncthing-relay.service")
19 machine.wait_for_open_port(12345)
20 machine.wait_for_open_port(12346)
21
22 out = machine.succeed(
23 "curl -sSf http://localhost:12346/status | jq -r '.options.\"provided-by\"'"
24 )
25 assert "nixos-test" in out
26 '';
27}