about summary refs log tree commit diff
path: root/nixos/tests/jotta-cli.nix
blob: 5eefe65c1d385e044560cacb6660f292ede2f8aa (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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"')
    '';
})