diff options
author | Patrick Hilhorst <git@hilhorst.be> | 2022-01-02 22:52:17 +0100 |
---|---|---|
committer | Patrick Hilhorst <git@hilhorst.be> | 2022-01-02 22:52:17 +0100 |
commit | a2f5092867927ea6a9bfc916ae191d3722350a33 (patch) | |
tree | 4583320837fd635d1990eeefa96551b98dab9ce8 /nixos/lib/test-driver/test_driver/driver.py | |
parent | 7830f000c57bb616b178a6a8eaef9659938ca7ea (diff) | |
download | nixpkgs-a2f5092867927ea6a9bfc916ae191d3722350a33.tar nixpkgs-a2f5092867927ea6a9bfc916ae191d3722350a33.tar.gz nixpkgs-a2f5092867927ea6a9bfc916ae191d3722350a33.tar.bz2 nixpkgs-a2f5092867927ea6a9bfc916ae191d3722350a33.tar.lz nixpkgs-a2f5092867927ea6a9bfc916ae191d3722350a33.tar.xz nixpkgs-a2f5092867927ea6a9bfc916ae191d3722350a33.tar.zst nixpkgs-a2f5092867927ea6a9bfc916ae191d3722350a33.zip |
nixos/test-driver: simplify logic, reduce interaction surface
Diffstat (limited to 'nixos/lib/test-driver/test_driver/driver.py')
-rw-r--r-- | nixos/lib/test-driver/test_driver/driver.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/nixos/lib/test-driver/test_driver/driver.py b/nixos/lib/test-driver/test_driver/driver.py index e22f9ee7a75..49a42fe5fb4 100644 --- a/nixos/lib/test-driver/test_driver/driver.py +++ b/nixos/lib/test-driver/test_driver/driver.py @@ -17,7 +17,7 @@ class Driver: tests: str vlans: List[VLan] machines: List[Machine] - polling_conditions: List[Callable] + polling_conditions: List[PollingCondition] def __init__( self, @@ -46,7 +46,7 @@ class Driver: keep_vm_state=keep_vm_state, name=cmd.machine_name, tmp_dir=tmp_dir, - fail_early=self.fail_early, + callbacks=[self.check_polling_conditions], ) for cmd in cmd(start_scripts) ] @@ -166,8 +166,9 @@ class Driver: def serial_stdout_off(self) -> None: rootlog._print_serial_logs = False - def fail_early(self) -> bool: - return any(not f() for f in self.polling_conditions) + def check_polling_conditions(self) -> None: + for condition in self.polling_conditions: + condition.maybe_raise() def polling_condition( self, @@ -184,7 +185,7 @@ class Driver: fun, seconds_interval, description, - ).check + ) def __enter__(self) -> None: driver.polling_conditions.append(self.condition) |