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

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

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

  machine = {
    services.syncthing = {
      enable = true;
      declarative = {
        devices.testDevice = {
          id = testId;
        };
        folders.testFolder = {
          path = "/tmp/test";
          devices = [ "testDevice" ];
        };
      };
    };
  };

  testScript = ''
    $machine->waitForUnit("syncthing-init.service");
    $machine->succeed("cat /var/lib/syncthing/config.xml") =~ /${testId}/ or die;
    $machine->succeed("cat /var/lib/syncthing/config.xml") =~ /testFolder/ or die;
  '';
})