about summary refs log tree commit diff
path: root/nixos/tests
diff options
context:
space:
mode:
authorEven Brenden <evenbrenden@users.noreply.github.com>2024-04-06 10:02:46 +0200
committerEven Brenden <evenbrenden@users.noreply.github.com>2024-04-29 09:14:47 +0200
commit021a0ffe57d5d378c4075efe0af15f344d1b0604 (patch)
tree6d15c0594a1103841338eeb50197d1b20d95c744 /nixos/tests
parent0d28066770464d19d637f6e8e42e8688420b6ac6 (diff)
nixos/jotta-cli: init jotta-cli
See https://github.com/NixOS/nixpkgs/issues/300063.
Diffstat (limited to 'nixos/tests')
-rw-r--r--nixos/tests/all-tests.nix1
-rw-r--r--nixos/tests/jotta-cli.nix25
2 files changed, 26 insertions, 0 deletions
diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix
index 6f78d68730c91..1540be565f84e 100644
--- a/nixos/tests/all-tests.nix
+++ b/nixos/tests/all-tests.nix
@@ -446,6 +446,7 @@ in {
   jirafeau = handleTest ./jirafeau.nix {};
   jitsi-meet = handleTest ./jitsi-meet.nix {};
   jool = import ./jool.nix { inherit pkgs runTest; };
+  jotta-cli = handleTest ./jotta-cli.nix {};
   k3s = handleTest ./k3s {};
   kafka = handleTest ./kafka.nix {};
   kanidm = handleTest ./kanidm.nix {};
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"')
+    '';
+})