Release NixOS 23.11
[NixPkgs.git] / nixos / tests / lxd / ui.nix
blob86cb30d8c2b6821e4b8b4d60bc136976fa44ff4f
1 import ../make-test-python.nix ({ pkgs, lib, ... }: {
2   name = "lxd-ui";
4   meta = with pkgs.lib.maintainers; {
5     maintainers = [ jnsgruk ];
6   };
8   nodes.machine = { lib, ... }: {
9     virtualisation = {
10       lxd.enable = true;
11       lxd.ui.enable = true;
12     };
14     environment.systemPackages = [ pkgs.curl ];
15   };
17   testScript = ''
18     machine.wait_for_unit("sockets.target")
19     machine.wait_for_unit("lxd.service")
20     machine.wait_for_file("/var/lib/lxd/unix.socket")
22     # Wait for lxd to settle
23     machine.succeed("lxd waitready")
25     # Configure LXC listen address
26     machine.succeed("lxc config set core.https_address :8443")
27     machine.succeed("systemctl restart lxd")
29     # Check that the LXD_UI environment variable is populated in the systemd unit
30     machine.succeed("cat /etc/systemd/system/lxd.service | grep 'LXD_UI'")
32     # Ensure the endpoint returns an HTML page with 'LXD UI' in the title
33     machine.succeed("curl -kLs https://localhost:8443/ui | grep '<title>LXD UI</title>'")
34   '';