summary refs log tree commit diff
path: root/nixos/tests/syncthing-init.nix
blob: b26c6103fd41d9d28bfb5a742240eee65ea87ef7 (plain) (blame)
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
import ./make-test-python.nix ({ lib, pkgs, ... }: let

  testId = "7CFNTQM-IMTJBHJ-3UWRDIU-ZGQJFR6-VCXZ3NB-XUH3KZO-N52ITXR-LAIYUAU";

in {
  name = "syncthing-init";
  meta.maintainers = with pkgs.lib.maintainers; [ lassulus ];

  nodes.machine = {
    services.syncthing = {
      enable = true;
      settings = {
        options.crashReportingEnabled = false;
        devices.testDevice = {
          id = testId;
        };
        folders.testFolder = {
          path = "/tmp/test";
          devices = [ "testDevice" ];
          versioning = {
            type = "simple";
            params.keep = "10";
          };
        };
        gui.user = "guiUser";
      };
    };
  };

  testScript = ''
    machine.wait_for_unit("syncthing-init.service")
    config = machine.succeed("cat /var/lib/syncthing/.config/syncthing/config.xml")

    assert "testFolder" in config
    assert "${testId}" in config
    assert "guiUser" in config
  '';
})