-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
01d242d
commit 10334ba
Showing
4 changed files
with
86 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,13 +25,36 @@ pkgs.nixosTest { | |
|
||
services.xserver.enable = true; | ||
services.xserver.displayManager = { | ||
lightdm.enable = true; | ||
gdm = { | ||
enable = true; | ||
debug = true; | ||
wayland = true; | ||
}; | ||
autoLogin = { | ||
enable = true; | ||
user = "alice"; | ||
}; | ||
}; | ||
services.xserver.desktopManager.mate.enable = true; | ||
services.xserver.desktopManager.gnome.enable = true; | ||
services.xserver.desktopManager.gnome.debug = true; | ||
|
||
systemd.user.services = { | ||
"org.gnome.Shell@wayland" = { | ||
serviceConfig = { | ||
ExecStart = [ | ||
# Clear the list before overriding it. | ||
"" | ||
# Eval API is now internal so Shell needs to run in unsafe mode. | ||
"${pkgs.gnome.gnome-shell}/bin/gnome-shell --unsafe-mode" | ||
]; | ||
}; | ||
}; | ||
}; | ||
|
||
# Make gnome extensions available | ||
#environment.systemPackages = lib.filter (e: e ? extensionUuid) (lib.attrValues pkgs.gnomeExtensions); | ||
#nixpkgs.config.allowBroken = true; | ||
#nixpkgs.config.allowAliases = false; | ||
|
||
# This just quiets some log spam we don't care about | ||
hardware.pulseaudio.enable = true; | ||
|
@@ -40,40 +63,65 @@ pkgs.nixosTest { | |
system.stateVersion = "23.05"; | ||
}; | ||
|
||
enableOCR = true; | ||
|
||
testScript = { nodes, ... }: | ||
let | ||
user = nodes.machine.users.users.alice; | ||
uid = toString user.uid; | ||
bus = "DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/${uid}/bus"; | ||
gdbus = "${bus} gdbus"; | ||
su = command: "su - ${user.name} -c '${command}'"; | ||
eval = "call --session -d org.gnome.Shell -o /org/gnome/Shell -m org.gnome.Shell.Eval"; | ||
startingUp = su "${gdbus} ${eval} Main.layoutManager._startingUp"; | ||
launchConsole = su "${bus} gapplication launch org.gnome.Console"; | ||
wmClass = su "${gdbus} ${eval} global.display.focus_window.wm_class"; | ||
in | ||
'' | ||
machine.start() | ||
# TODO: currently launcher will shut itself down if its secret file doesn't exist, | ||
# so we don't get all the way through setup and launcher doesn't stay running. | ||
# In the future, we'll want to validate setup and that the service is running. | ||
with subtest("gnome login"): | ||
machine.wait_for_unit("display-manager.service") | ||
# machine.wait_for_file("/run/user/${uid}/wayland-0") | ||
# machine.wait_for_unit("default.target", "${user.name}") | ||
machine.screenshot("test-screen2.png") | ||
with subtest("kolide-launcher service starts"): | ||
machine.wait_for_unit("kolide-launcher.service") | ||
machine.sleep(10) | ||
machine.systemctl("stop kolide-launcher.service") | ||
with subtest("gnome shell"): | ||
machine.wait_until_succeeds("${startingUp} | grep -q 'true,..false'") | ||
machine.screenshot("test-screen3.png") | ||
with subtest("open gnome console"): | ||
machine.send_key("esc") | ||
machine.succeed("${launchConsole}") | ||
machine.wait_until_succeeds("${wmClass} | grep -q 'true,...org.gnome.Console'") | ||
machine.sleep(20) | ||
machine.screenshot("test-screen4.png") | ||
with subtest("enable appindicator extension"): | ||
machine.succeed("${su "gnome-extensions enable [email protected]"}") | ||
machine.screenshot("test-screen5.png") | ||
with subtest("set up secret file"): | ||
machine.copy_from_host("${./test-secret}", "/etc/kolide-k2/secret") | ||
with subtest("launcher set up correctly"): | ||
with subtest("launcher service runs and is set up correctly"): | ||
machine.systemctl("stop kolide-launcher.service") | ||
machine.systemctl("start kolide-launcher.service") | ||
machine.wait_for_unit("kolide-launcher.service") | ||
machine.wait_for_file("/var/kolide-k2/k2device.kolide.com/debug.json") | ||
machine.sleep(60) | ||
machine.screenshot("test-screen7.png") | ||
machine.wait_until_succeeds("pgrep osqueryd") | ||
with subtest("get a screenshot"): | ||
machine.wait_for_unit("display-manager.service") | ||
with subtest("launcher desktop runs"): | ||
machine.wait_for_file("/var/kolide-k2/k2device.kolide.com/kolide.png") | ||
machine.wait_for_file("/var/kolide-k2/k2device.kolide.com/menu.json") | ||
machine.screenshot("test-screen8.png") | ||
machine.wait_for_file("${user.home}/.Xauthority") | ||
machine.succeed("xauth merge ${user.home}/.Xauthority") | ||
# print(machine.get_screen_text()) | ||
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") | ||
machine.sleep(20) | ||
machine.screenshot("test.png") | ||
# machine.wait_until_succeeds("pgrep -U ${uid} launcher") | ||
# machine.screenshot("test-screen9.png") | ||
machine.shutdown() | ||
''; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
test-secret |