about summary refs log tree commit diff
path: root/nixos/tests/incus/socket-activated.nix
blob: 55c5496396e9148437cd6dc57c154c2f0ab1cd80 (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
26
27
28
29
30
31
32
import ../make-test-python.nix ({ pkgs, lib, incus ? pkgs.incus-lts, ... } :

{
  name = "incus-socket-activated";

  meta = {
    maintainers = lib.teams.lxc.members;
  };

  nodes.machine = { lib, ... }: {
    virtualisation = {
      incus = {
        enable = true;
        package = incus;
        socketActivation = true;
      };
    };
    networking.nftables.enable = true;
  };

  testScript = ''
    machine.wait_for_unit("incus.socket")

    # ensure service is not running by default
    machine.fail("systemctl is-active incus.service")
    machine.fail("systemctl is-active incus-preseed.service")

    # access the socket and ensure the service starts
    machine.succeed("incus list")
    machine.wait_for_unit("incus.service")
  '';
})