about summary refs log tree commit diff
path: root/nixos/lib
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2022-09-02 18:06:03 +0000
committerAlyssa Ross <hi@alyssa.is>2022-09-02 18:06:03 +0000
commit488412a1db0c3046b6699168cdb2a581c88181b8 (patch)
tree3fb596ca598cc8ec10f1f85705d0cfcd782f6219 /nixos/lib
parent22a5797173e4fa55084670212e59dc0bdd8e6b6c (diff)
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
Diffstat (limited to 'nixos/lib')
-rw-r--r--nixos/lib/test-driver/test_driver/machine.py6
1 files 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 3ff3cf5645f82..117d9d59e0258 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)