summary refs log tree commit diff
path: root/nixos/tests/trilium-server.nix
diff options
context:
space:
mode:
authorChristian Kampka <christian@kampka.net>2019-12-08 14:23:25 +0100
committerChristian Kampka <christian@kampka.net>2019-12-19 10:14:12 +0100
commit82f038d46861062140511c55ece98bb37954dc93 (patch)
tree17b84f024a3918878e405f145b691b8f7c10b505 /nixos/tests/trilium-server.nix
parent1f060b43a613e722231f22b06e18ebd827904547 (diff)
downloadnixpkgs-82f038d46861062140511c55ece98bb37954dc93.tar
nixpkgs-82f038d46861062140511c55ece98bb37954dc93.tar.gz
nixpkgs-82f038d46861062140511c55ece98bb37954dc93.tar.bz2
nixpkgs-82f038d46861062140511c55ece98bb37954dc93.tar.lz
nixpkgs-82f038d46861062140511c55ece98bb37954dc93.tar.xz
nixpkgs-82f038d46861062140511c55ece98bb37954dc93.tar.zst
nixpkgs-82f038d46861062140511c55ece98bb37954dc93.zip
trilium-server: Add module
Diffstat (limited to 'nixos/tests/trilium-server.nix')
-rw-r--r--nixos/tests/trilium-server.nix37
1 files changed, 37 insertions, 0 deletions
diff --git a/nixos/tests/trilium-server.nix b/nixos/tests/trilium-server.nix
new file mode 100644
index 00000000000..ca9e8ba2c56
--- /dev/null
+++ b/nixos/tests/trilium-server.nix
@@ -0,0 +1,37 @@
+import ./make-test-python.nix ({ ... }: {
+  name = "trilium-server";
+  nodes = {
+    default = {
+      services.trilium-server.enable = true;
+    };
+    configured = {
+      services.trilium-server = {
+        enable = true;
+        dataDir = "/data/trilium";
+      };
+    };
+  };
+
+  testScript =
+    ''
+      start_all()
+
+      with subtest("by default works without configuration"):
+          default.wait_for_unit("trilium-server.service")
+
+      with subtest("by default available on port 8080"):
+          default.wait_for_unit("trilium-server.service")
+          default.wait_for_open_port(8080)
+          # we output to /dev/null here to avoid a python UTF-8 decode error
+          # but the check will still fail if the service doesn't respond
+          default.succeed("curl --fail -o /dev/null 127.0.0.1:8080")
+
+      with subtest("by default creates empty document"):
+          default.wait_for_unit("trilium-server.service")
+          default.succeed("test -f /var/lib/trilium/document.db")
+
+      with subtest("configured with custom data store"):
+          configured.wait_for_unit("trilium-server.service")
+          configured.succeed("test -f /data/trilium/document.db")
+    '';
+})