diff options
author | Christian Kampka <christian@kampka.net> | 2019-12-08 14:23:25 +0100 |
---|---|---|
committer | Christian Kampka <christian@kampka.net> | 2019-12-19 10:14:12 +0100 |
commit | 82f038d46861062140511c55ece98bb37954dc93 (patch) | |
tree | 17b84f024a3918878e405f145b691b8f7c10b505 /nixos/tests/trilium-server.nix | |
parent | 1f060b43a613e722231f22b06e18ebd827904547 (diff) |
trilium-server: Add module
Diffstat (limited to 'nixos/tests/trilium-server.nix')
-rw-r--r-- | nixos/tests/trilium-server.nix | 37 |
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 0000000000000..ca9e8ba2c56f6 --- /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") + ''; +}) |