diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index cb712b8e2aa6..5bc923268fae 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -1295,7 +1295,7 @@ in { 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; diff --git a/nixos/tests/xss-lock.nix b/nixos/tests/xss-lock.nix index f46db1e49c28..fb09715fc166 100644 --- a/nixos/tests/xss-lock.nix +++ b/nixos/tests/xss-lock.nix @@ -1,54 +1,51 @@ -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") + ''; +}