depot/nixos/tests/jotta-cli.nix
Luke Granger-Brown 57725ef3ec Squashed 'third_party/nixpkgs/' content from commit 76612b17c0ce
git-subtree-dir: third_party/nixpkgs
git-subtree-split: 76612b17c0ce71689921ca12d9ffdc9c23ce40b2
2024-11-10 23:59:47 +00:00

25 lines
807 B
Nix

import ./make-test-python.nix ({ pkgs, ... }: {
name = "jotta-cli";
meta.maintainers = with pkgs.lib.maintainers; [ evenbrenden ];
nodes.machine = { pkgs, ... }: {
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"')
'';
})