From 51ff3add1a464f69c560908b897f285bc83cd3dc Mon Sep 17 00:00:00 2001 From: ivanbrennan Date: Thu, 20 Jan 2022 09:58:05 -0500 Subject: [PATCH 1/2] nixosTests.xmonad: avoid sleep() Replace sleep() calls where possible, using wait_for_* methods. This should provide more robustness in cases where tests are running on a congested system. --- nixos/tests/xmonad.nix | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/nixos/tests/xmonad.nix b/nixos/tests/xmonad.nix index a14d4b819eb6..eb2e0563d7c3 100644 --- a/nixos/tests/xmonad.nix +++ b/nixos/tests/xmonad.nix @@ -90,8 +90,7 @@ in { # original config has a keybinding that creates somefile machine.send_key("alt-ctrl-t") - machine.sleep(1) - machine.succeed("stat /tmp/somefile") + machine.wait_for_file("/tmp/somefile") # set up the new config machine.succeed("mkdir -p ${user.home}/.xmonad") @@ -103,15 +102,13 @@ in { # new config has a keybinding that deletes somefile machine.send_key("alt-ctrl-r") - machine.sleep(1) - machine.fail("stat /tmp/somefile") + machine.wait_until_fails("stat /tmp/somefile", timeout=30) # restart with the old config, and confirm the old keybinding is back machine.succeed("rm /tmp/oldXMonad") machine.send_key("alt-q") machine.wait_for_file("/tmp/oldXMonad") machine.send_key("alt-ctrl-t") - machine.sleep(1) - machine.succeed("stat /tmp/somefile") + machine.wait_for_file("/tmp/somefile") ''; }) From 8a1d379992a58edc9453d10649601c6cc7fdad6c Mon Sep 17 00:00:00 2001 From: ivanbrennan Date: Thu, 20 Jan 2022 11:17:03 -0500 Subject: [PATCH 2/2] nixosTests.xmonad: add ivanbrennan to maintainers --- nixos/tests/xmonad.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/tests/xmonad.nix b/nixos/tests/xmonad.nix index eb2e0563d7c3..a2fb38e53bd1 100644 --- a/nixos/tests/xmonad.nix +++ b/nixos/tests/xmonad.nix @@ -52,7 +52,7 @@ let in { name = "xmonad"; meta = with pkgs.lib.maintainers; { - maintainers = [ nequissimus ]; + maintainers = [ nequissimus ivanbrennan ]; }; machine = { pkgs, ... }: {