about summary refs log tree commit diff
path: root/nixos/tests/jotta-cli.nix
diff options
context:
space:
mode:
authorgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>2024-05-03 00:13:16 +0000
committerGitHub <noreply@github.com>2024-05-03 00:13:16 +0000
commit26d2f291dffdcb7e5f40896be3fc3bc72538dbd0 (patch)
tree5eab6c80968fb769f5433bc2fa6b96f102d17701 /nixos/tests/jotta-cli.nix
parent2918b2c876b74d0ba5e333676ee86228f51c24e8 (diff)
parent172094c8c1f83ee7f6d7dd10e64fdc7da0e4ac3b (diff)
Merge master into haskell-updates
Diffstat (limited to 'nixos/tests/jotta-cli.nix')
-rw-r--r--nixos/tests/jotta-cli.nix25
1 files changed, 25 insertions, 0 deletions
diff --git a/nixos/tests/jotta-cli.nix b/nixos/tests/jotta-cli.nix
new file mode 100644
index 0000000000000..5eefe65c1d385
--- /dev/null
+++ b/nixos/tests/jotta-cli.nix
@@ -0,0 +1,25 @@
+import ./make-test-python.nix ({ pkgs, ... }: {
+
+  name = "jotta-cli";
+  meta.maintainers = with pkgs.lib.maintainers; [ evenbrenden ];
+
+  nodes.machine = { pkgs, ... }: {
+    user.services.jotta-cli.enable = true;
+    imports = [ ./common/user-account.nix ];
+  };
+
+  testScript = { nodes, ... }:
+    let uid = toString nodes.machine.users.users.alice.uid;
+    in ''
+      machine.start()
+
+      machine.succeed("loginctl enable-linger alice")
+      machine.wait_for_unit("user@${uid}.service")
+
+      machine.wait_for_unit("jottad.service", "alice")
+      machine.wait_for_open_unix_socket("/run/user/${uid}/jottad/jottad.socket")
+
+      # "jotta-cli version" should fail if jotta-cli cannot connect to jottad
+      machine.succeed('XDG_RUNTIME_DIR=/run/user/${uid} su alice -c "jotta-cli version"')
+    '';
+})