Skip to content

Commit

Permalink
tests: improve AdminOperationsFuzzer.wait
Browse files Browse the repository at this point in the history
This can drop out earlier when there is an error,
rather than waiting in vain for the execution count
to reach a target that it never will.

Related: redpanda-data#5950
  • Loading branch information
jcsp committed Aug 12, 2022
1 parent 6883b90 commit e0ff6b9
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion tests/rptest/services/admin_ops_fuzzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,4 +539,20 @@ def stop(self):
assert self.error is None, f"Encountered an error in admin operations fuzzer: {self.error}"

def wait(self, count, timeout):
wait_until(lambda: self.executed > count, timeout, 2)
def check():
# Drop out immediately if the main loop errored out.
if self.error:
self.redpanda.logger.error(
f"wait: terminating for error {self.error}")
raise self.error

if self.executed >= count:
return True
elif self._stopping.is_set():
# We cannot ever reach the count, error out
self.redpanda.logger.error(f"wait: terminating for stop")
raise RuntimeError(
f"Stopped without reaching target ({self.executed}/{count})"
)

wait_until(check, timeout_sec=timeout, backoff_sec=2)

0 comments on commit e0ff6b9

Please sign in to comment.