summary refs log tree commit diff
path: root/nixos/tests/syncthing-init.nix
diff options
context:
space:
mode:
authorlassulus <lassulus@lassul.us>2019-04-21 23:05:07 +0200
committerLassulus <github@lassul.us>2019-05-20 17:56:17 +0900
commita3e7e1bbc8e4fea44fa2bdaac74a2371f1989a82 (patch)
tree5b34c297478601674f633d075bd98b3979fafd15 /nixos/tests/syncthing-init.nix
parent9d8c27e4f4b129f910a992d77b1c740c0a783f08 (diff)
downloadnixpkgs-a3e7e1bbc8e4fea44fa2bdaac74a2371f1989a82.tar
nixpkgs-a3e7e1bbc8e4fea44fa2bdaac74a2371f1989a82.tar.gz
nixpkgs-a3e7e1bbc8e4fea44fa2bdaac74a2371f1989a82.tar.bz2
nixpkgs-a3e7e1bbc8e4fea44fa2bdaac74a2371f1989a82.tar.lz
nixpkgs-a3e7e1bbc8e4fea44fa2bdaac74a2371f1989a82.tar.xz
nixpkgs-a3e7e1bbc8e4fea44fa2bdaac74a2371f1989a82.tar.zst
nixpkgs-a3e7e1bbc8e4fea44fa2bdaac74a2371f1989a82.zip
nixos/syncthing: add options for declarative device/folder config
Diffstat (limited to 'nixos/tests/syncthing-init.nix')
-rw-r--r--nixos/tests/syncthing-init.nix30
1 files changed, 30 insertions, 0 deletions
diff --git a/nixos/tests/syncthing-init.nix b/nixos/tests/syncthing-init.nix
new file mode 100644
index 00000000000..811a466ff94
--- /dev/null
+++ b/nixos/tests/syncthing-init.nix
@@ -0,0 +1,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;
+  '';
+})
+