nixosTests.xss-lock: migrate to runTest

Part Of #386873

Changed files
+39 -42
nixos
+1 -1
nixos/tests/all-tests.nix
···
xrdp = handleTest ./xrdp.nix {};
xrdp-with-audio-pulseaudio = handleTest ./xrdp-with-audio-pulseaudio.nix {};
xscreensaver = handleTest ./xscreensaver.nix {};
-
xss-lock = handleTest ./xss-lock.nix {};
+
xss-lock = runTest ./xss-lock.nix;
xterm = runTest ./xterm.nix;
xxh = runTest ./xxh.nix;
yabar = runTest ./yabar.nix;
+38 -41
nixos/tests/xss-lock.nix
···
-
import ./make-test-python.nix (
-
{ pkgs, lib, ... }:
-
{
-
name = "xss-lock";
-
meta.maintainers = [ ];
+
{
+
name = "xss-lock";
+
meta.maintainers = [ ];
-
nodes = {
-
simple = {
+
nodes = {
+
simple = {
+
imports = [
+
./common/x11.nix
+
./common/user-account.nix
+
];
+
programs.xss-lock.enable = true;
+
test-support.displayManager.auto.user = "alice";
+
};
+
+
custom_lockcmd =
+
{ pkgs, ... }:
+
{
imports = [
./common/x11.nix
./common/user-account.nix
];
-
programs.xss-lock.enable = true;
test-support.displayManager.auto.user = "alice";
-
};
-
custom_lockcmd =
-
{ pkgs, ... }:
-
{
-
imports = [
-
./common/x11.nix
-
./common/user-account.nix
+
programs.xss-lock = {
+
enable = true;
+
extraOptions = [
+
"-n"
+
"${pkgs.libnotify}/bin/notify-send 'About to sleep!'"
];
-
test-support.displayManager.auto.user = "alice";
-
-
programs.xss-lock = {
-
enable = true;
-
extraOptions = [
-
"-n"
-
"${pkgs.libnotify}/bin/notify-send 'About to sleep!'"
-
];
-
lockerCommand = "${pkgs.xlockmore}/bin/xlock -mode ant";
-
};
+
lockerCommand = "${pkgs.xlockmore}/bin/xlock -mode ant";
};
-
};
+
};
+
};
-
testScript = ''
-
def perform_xsslock_test(machine, lockCmd):
-
machine.start()
-
machine.wait_for_x()
-
machine.wait_for_unit("xss-lock.service", "alice")
-
machine.fail(f"pgrep {lockCmd}")
-
machine.succeed("su -l alice -c 'xset dpms force standby'")
-
machine.wait_until_succeeds(f"pgrep {lockCmd}")
+
testScript = ''
+
def perform_xsslock_test(machine, lockCmd):
+
machine.start()
+
machine.wait_for_x()
+
machine.wait_for_unit("xss-lock.service", "alice")
+
machine.fail(f"pgrep {lockCmd}")
+
machine.succeed("su -l alice -c 'xset dpms force standby'")
+
machine.wait_until_succeeds(f"pgrep {lockCmd}")
-
with subtest("simple"):
-
perform_xsslock_test(simple, "i3lock")
+
with subtest("simple"):
+
perform_xsslock_test(simple, "i3lock")
-
with subtest("custom_cmd"):
-
perform_xsslock_test(custom_lockcmd, "xlock")
-
'';
-
}
-
)
+
with subtest("custom_cmd"):
+
perform_xsslock_test(custom_lockcmd, "xlock")
+
'';
+
}