From 488412a1db0c3046b6699168cdb2a581c88181b8 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Fri, 2 Sep 2022 18:06:03 +0000 Subject: [PATCH 1/2] nixos/test-driver: add wait_for_unit() timeout arg For example, the wait_for_unit() call in the Moodle test times out for myself and others[1], so it would be good to be able to increase it to something less likely to be hit by a test that would otherwise pass. [1]: https://github.com/NixOS/nixpkgs/pull/177052#issue-1266336706 --- nixos/lib/test-driver/test_driver/machine.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/nixos/lib/test-driver/test_driver/machine.py b/nixos/lib/test-driver/test_driver/machine.py index 3ff3cf5645f8..117d9d59e025 100644 --- a/nixos/lib/test-driver/test_driver/machine.py +++ b/nixos/lib/test-driver/test_driver/machine.py @@ -426,7 +426,9 @@ class Machine: self.monitor.send(message) return self.wait_for_monitor_prompt() - def wait_for_unit(self, unit: str, user: Optional[str] = None) -> None: + def wait_for_unit( + self, unit: str, user: Optional[str] = None, timeout: int = 900 + ) -> None: """Wait for a systemd unit to get into "active" state. Throws exceptions on "failed" and "inactive" states as well as after timing out. @@ -456,7 +458,7 @@ class Machine: unit, f" with user {user}" if user is not None else "" ) ): - retry(check_active) + retry(check_active, timeout) def get_unit_info(self, unit: str, user: Optional[str] = None) -> Dict[str, str]: status, lines = self.systemctl('--no-pager show "{}"'.format(unit), user) From 1e8f59b2ee457e0b4f2edf62cf89054f501a0706 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Fri, 2 Sep 2022 18:09:00 +0000 Subject: [PATCH 2/2] nixosTests.moodle: increase timeout With the default timeout, this test would time out too early for me and others[1]. [1]: https://github.com/NixOS/nixpkgs/pull/177052#issue-1266336706 --- nixos/tests/moodle.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/tests/moodle.nix b/nixos/tests/moodle.nix index 4570e8963882..8fd011e0cb21 100644 --- a/nixos/tests/moodle.nix +++ b/nixos/tests/moodle.nix @@ -16,7 +16,7 @@ import ./make-test-python.nix ({ pkgs, lib, ... }: { testScript = '' start_all() - machine.wait_for_unit("phpfpm-moodle.service") + machine.wait_for_unit("phpfpm-moodle.service", timeout=1800) machine.wait_until_succeeds("curl http://localhost/ | grep 'You are not logged in'") ''; })