diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 152f079..c440aff 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -35,6 +35,7 @@ jobs: - name: upload test screenshot uses: actions/upload-artifact@v4 with: + name: test-screenshot path: ${{ steps.test-derivation.outputs.drvpath }}/test.png retention-days: 1 diff --git a/tests/kolide-launcher.nix b/tests/kolide-launcher.nix index cd5f5ac..364462d 100644 --- a/tests/kolide-launcher.nix +++ b/tests/kolide-launcher.nix @@ -15,10 +15,27 @@ pkgs.nixosTest { imports = [ flake.nixosModules.kolide-launcher ]; - config = { - services.kolide-launcher.enable = true; - system.stateVersion = "23.05"; + + users.users.alice = { + isNormalUser = true; + description = "Alice Test"; + password = "alicetest"; + uid = 1000; + }; + + services.xserver.enable = true; + services.xserver.displayManager = { + lightdm.enable = true; + autoLogin = { + enable = true; + user = "alice"; + }; }; + services.xserver.desktopManager.gnome.enable = true; + services.xserver.displayManager.defaultSession = "gnome-xorg"; + + services.kolide-launcher.enable = true; + system.stateVersion = "23.05"; }; testScript = { nodes, ... }: '' @@ -32,11 +49,16 @@ pkgs.nixosTest { machine.wait_for_unit("kolide-launcher.service") machine.systemctl("status kolide-launcher.service") - machine.screenshot("test.png") - with subtest("launcher set up correctly"): machine.wait_for_file("/var/lib/kolide-k2/k2device.kolide.com/debug.json") + with subtest("get a screenshot"): + machine.wait_for_x() + machine.wait_for_unit("default.target", "alice") + machine.wait_for_file("/run/user/1000/gdm/Xauthority") + machine.succeed("xauth merge /run/user/1000/gdm/Xauthority") + machine.screenshot("test.png") + machine.shutdown() ''; }