nixosTests.{qtile,ragnarwm}: migrate to runTestOn

This commit is contained in:
Sigmanificient 2025-03-11 21:24:52 +01:00
parent 9161971a37
commit 1434add94c
3 changed files with 80 additions and 84 deletions

View file

@ -959,7 +959,7 @@ in {
qgis = handleTest ./qgis.nix { package = pkgs.qgis; }; qgis = handleTest ./qgis.nix { package = pkgs.qgis; };
qgis-ltr = handleTest ./qgis.nix { package = pkgs.qgis-ltr; }; qgis-ltr = handleTest ./qgis.nix { package = pkgs.qgis-ltr; };
qownnotes = handleTest ./qownnotes.nix {}; qownnotes = handleTest ./qownnotes.nix {};
qtile = handleTestOn ["x86_64-linux" "aarch64-linux"] ./qtile/default.nix {}; qtile = runTestOn ["x86_64-linux" "aarch64-linux"] ./qtile/default.nix;
quake3 = handleTest ./quake3.nix {}; quake3 = handleTest ./quake3.nix {};
quicktun = handleTest ./quicktun.nix {}; quicktun = handleTest ./quicktun.nix {};
quickwit = handleTest ./quickwit.nix {}; quickwit = handleTest ./quickwit.nix {};
@ -968,7 +968,7 @@ in {
radarr = handleTest ./radarr.nix {}; radarr = handleTest ./radarr.nix {};
radicale = handleTest ./radicale.nix {}; radicale = handleTest ./radicale.nix {};
radicle = runTest ./radicle.nix; radicle = runTest ./radicle.nix;
ragnarwm = handleTest ./ragnarwm.nix {}; ragnarwm = runTestOn ["x86_64-linux" "aarch64-linux"] ./ragnarwm.nix;
rasdaemon = handleTest ./rasdaemon.nix {}; rasdaemon = handleTest ./rasdaemon.nix {};
rathole = handleTest ./rathole.nix {}; rathole = handleTest ./rathole.nix {};
readarr = handleTest ./readarr.nix {}; readarr = handleTest ./readarr.nix {};

View file

@ -1,54 +1,52 @@
import ../make-test-python.nix ( { lib, ... }:
{ lib, ... }: {
{ name = "qtile";
name = "qtile";
meta = { meta = {
maintainers = with lib.maintainers; [ sigmanificient ]; maintainers = with lib.maintainers; [ sigmanificient ];
}; };
nodes.machine = nodes.machine =
{ pkgs, lib, ... }: { pkgs, lib, ... }:
let let
# We create a custom Qtile configuration file that adds a widget from # We create a custom Qtile configuration file that adds a widget from
# qtile-extras to the bar. This ensure that the qtile-extras package # qtile-extras to the bar. This ensure that the qtile-extras package
# also works, and that extraPackages behave as expected. # also works, and that extraPackages behave as expected.
config-deriv = pkgs.callPackage ./config.nix { }; config-deriv = pkgs.callPackage ./config.nix { };
in in
{ {
imports = [ imports = [
../common/x11.nix ../common/x11.nix
../common/user-account.nix ../common/user-account.nix
]; ];
test-support.displayManager.auto.user = "alice"; test-support.displayManager.auto.user = "alice";
services.xserver.windowManager.qtile = { services.xserver.windowManager.qtile = {
enable = true; enable = true;
configFile = "${config-deriv}/config.py"; configFile = "${config-deriv}/config.py";
extraPackages = ps: [ ps.qtile-extras ]; extraPackages = ps: [ ps.qtile-extras ];
};
services.displayManager.defaultSession = lib.mkForce "qtile";
environment.systemPackages = [ pkgs.kitty ];
}; };
testScript = '' services.displayManager.defaultSession = lib.mkForce "qtile";
with subtest("ensure x starts"):
machine.wait_for_x()
machine.wait_for_file("/home/alice/.Xauthority")
machine.succeed("xauth merge ~alice/.Xauthority")
with subtest("ensure client is available"): environment.systemPackages = [ pkgs.kitty ];
machine.succeed("qtile --version") };
with subtest("ensure we can open a new terminal"): testScript = ''
machine.sleep(2) with subtest("ensure x starts"):
machine.send_key("meta_l-ret") machine.wait_for_x()
machine.wait_for_window(r"alice.*?machine") machine.wait_for_file("/home/alice/.Xauthority")
machine.sleep(2) machine.succeed("xauth merge ~alice/.Xauthority")
machine.screenshot("terminal")
''; with subtest("ensure client is available"):
} machine.succeed("qtile --version")
)
with subtest("ensure we can open a new terminal"):
machine.sleep(2)
machine.send_key("meta_l-ret")
machine.wait_for_window(r"alice.*?machine")
machine.sleep(2)
machine.screenshot("terminal")
'';
}

View file

@ -1,40 +1,38 @@
import ./make-test-python.nix ( { lib, ... }:
{ lib, ... }: {
{ name = "ragnarwm";
name = "ragnarwm";
meta = { meta = {
maintainers = with lib.maintainers; [ sigmanificient ]; maintainers = with lib.maintainers; [ sigmanificient ];
};
nodes.machine =
{ pkgs, lib, ... }:
{
imports = [
./common/x11.nix
./common/user-account.nix
];
test-support.displayManager.auto.user = "alice";
services.displayManager.defaultSession = lib.mkForce "ragnar";
services.xserver.windowManager.ragnarwm.enable = true;
# Setup the default terminal of Ragnar
environment.systemPackages = [ pkgs.alacritty ];
}; };
nodes.machine = testScript = ''
{ pkgs, lib, ... }: with subtest("ensure x starts"):
{ machine.wait_for_x()
imports = [ machine.wait_for_file("/home/alice/.Xauthority")
./common/x11.nix machine.succeed("xauth merge ~alice/.Xauthority")
./common/user-account.nix
];
test-support.displayManager.auto.user = "alice";
services.displayManager.defaultSession = lib.mkForce "ragnar";
services.xserver.windowManager.ragnarwm.enable = true;
# Setup the default terminal of Ragnar with subtest("ensure we can open a new terminal"):
environment.systemPackages = [ pkgs.alacritty ]; # Sleeping a bit before the test, as it may help for sending keys
}; machine.sleep(2)
machine.send_key("meta_l-ret")
testScript = '' machine.wait_for_window(r"alice.*?machine")
with subtest("ensure x starts"): machine.sleep(2)
machine.wait_for_x() machine.screenshot("terminal")
machine.wait_for_file("/home/alice/.Xauthority") '';
machine.succeed("xauth merge ~alice/.Xauthority") }
with subtest("ensure we can open a new terminal"):
# Sleeping a bit before the test, as it may help for sending keys
machine.sleep(2)
machine.send_key("meta_l-ret")
machine.wait_for_window(r"alice.*?machine")
machine.sleep(2)
machine.screenshot("terminal")
'';
}
)