Skip to content

Commit

Permalink
try gnome
Browse files Browse the repository at this point in the history
  • Loading branch information
RebeccaMahany committed Jan 19, 2024
1 parent d248829 commit 531449d
Showing 1 changed file with 53 additions and 14 deletions.
67 changes: 53 additions & 14 deletions tests/kolide-launcher.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,31 @@ pkgs.nixosTest {
uid = 1000;
};

# Add Gnome extensions
environment.systemPackages = [ pkgs.gnomeExtensions.appindicator ];

services.xserver.enable = true;
services.xserver.displayManager = {
lightdm.enable = true;
gdm.enable = true;
gdm.debug = true;
autoLogin = {
enable = true;
user = "alice";
};
};
services.xserver.desktopManager.mate.enable = true;
services.xserver.desktopManager.mate.debug = true;
services.xserver.desktopManager.gnome.enable = true;
services.xserver.desktopManager.gnome.debug = true;
services.xserver.displayManager.defaultSession = "gnome-xorg";
systemd.user.services = {
"org.gnome.Shell@x11" = {
serviceConfig = {
ExecStart = [
""
"${pkgs.gnome.gnome-shell}/bin/gnome-shell --unsafe-mode"
];
};
};
};

# This just quiets some log spam we don't care about
hardware.pulseaudio.enable = true;
Expand All @@ -47,26 +62,50 @@ pkgs.nixosTest {
let
user = nodes.machine.users.users.alice;
uid = toString user.uid;
xauthority = "${user.home}/.Xauthority";
# xauthority = "${user.home}/.Xauthority";
ci = builtins.getEnv "CI";

bus = "DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/${uid}/bus";
xauthority = "/run/user/${uid}/gdm/Xauthority";
display = "DISPLAY=:0.0";
env = "${bus} XAUTHORITY=${xauthority} ${display}";
run = command: "su - ${user.name} -c '${bus} ${command}'";
eval = command: run "gdbus call --session -d org.gnome.Shell -o /org/gnome/Shell -m org.gnome.Shell.Eval ${command}";
startingUp = eval "Main.layoutManager._startingUp";
launchConsole = run "gapplication launch org.gnome.Console";
wmClass = eval "global.display.focus_window.wm_class";
in
''
if "${ci}":
machine.start()
with subtest("log in to MATE"):
machine.wait_for_unit("display-manager.service", timeout=120)
with subtest("log in to GNOME"):
machine.wait_for_x()
machine.wait_for_unit("default.target", "${user.name}")
machine.wait_for_file("${xauthority}")
machine.succeed("xauth merge ${xauthority}")
machine.wait_until_succeeds("pgrep marco")
machine.wait_for_window("marco")
machine.wait_until_succeeds("pgrep mate-panel")
machine.wait_for_window("Top Panel")
machine.wait_for_window("Bottom Panel")
machine.wait_until_succeeds("pgrep caja")
machine.wait_for_window("Caja")
assert "alice" in machine.succeed("getfacl -p /dev/snd/timer")
with subtest("wait for GNOME Shell"):
machine.wait_until_succeeds(
"${startingUp} | grep -q 'true,..false'"
)
machine.screenshot("test-1.png")
with subtest("open console"):
machine.send_key("esc")
machine.succeed(
"${launchConsole}"
)
machine.wait_until_succeeds(
"${wmClass} | grep -q 'true,...kgx'"
)
machine.sleep(20)
machine.screenshot("test-screen1.png")
machine.screenshot("test-2.png")
with subtest("enable appindicator extension"):
machine.succeed("${run "gnome-extensions enable [email protected]"}")
machine.screenshot("test-3.png")
with subtest("set up secret file"):
machine.copy_from_host("${./test-secret}", "/etc/kolide-k2/secret")
Expand Down

0 comments on commit 531449d

Please sign in to comment.