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