Get the ssh bootstrap tests fully working

This commit is contained in:
Kovid Goyal
2022-02-23 20:51:56 +05:30
parent bf26a3f569
commit 8ca3a511cc
3 changed files with 29 additions and 16 deletions

View File

@@ -235,9 +235,9 @@ class PTY:
return bytes_read
def wait_till(self, q, timeout=10):
st = time.monotonic()
while not q() and time.monotonic() - st < timeout:
self.process_input_from_child(timeout=timeout - (time.monotonic() - st))
end_time = time.monotonic() + timeout
while not q() and time.monotonic() <= end_time:
self.process_input_from_child(timeout=max(0, end_time - time.monotonic()))
if not q():
raise TimeoutError(f'The condition was not met. Screen contents: \n {repr(self.screen_contents())}')