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
(cherry picked from commit e0ff6b9)
  • Loading branch information
jcsp authored and vbotbuildovich committed Aug 15, 2022
1 parent 5c2dcea commit fc9b84e
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 fc9b84e

Please sign in to comment.