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
This commit is contained in:
parent
22a5797173
commit
488412a1db
@ -426,7 +426,9 @@ class Machine:
|
|||||||
self.monitor.send(message)
|
self.monitor.send(message)
|
||||||
return self.wait_for_monitor_prompt()
|
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.
|
"""Wait for a systemd unit to get into "active" state.
|
||||||
Throws exceptions on "failed" and "inactive" states as well as
|
Throws exceptions on "failed" and "inactive" states as well as
|
||||||
after timing out.
|
after timing out.
|
||||||
@ -456,7 +458,7 @@ class Machine:
|
|||||||
unit, f" with user {user}" if user is not None else ""
|
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]:
|
def get_unit_info(self, unit: str, user: Optional[str] = None) -> Dict[str, str]:
|
||||||
status, lines = self.systemctl('--no-pager show "{}"'.format(unit), user)
|
status, lines = self.systemctl('--no-pager show "{}"'.format(unit), user)
|
||||||
|
Loading…
Reference in New Issue
Block a user