Skip to content

Commit

Permalink
add @ok_to_fail decorator
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewhsu authored and savex committed Sep 8, 2023
1 parent 62e0285 commit 8a6567d
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion ducktape/tests/runner_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,27 @@ def run(self):
if num_runs != self.deflake_num:
msg += "\n" + "~" * max(len(line) for line in summary.split('\n'))

self.log(logging.INFO, msg)
data = self.run_test()

if self.test_context.ok_to_fail:
test_status = OPASS
self.log(logging.INFO, "OPASS")
else:
test_status = PASS
self.log(logging.INFO, "PASS")

except BaseException as e:
if self.test_context.ok_to_fail:
test_status = OFAIL
err_trace = self._exc_msg(e)
summary += err_trace
self.log(logging.INFO, "OFAIL: " + err_trace)
else:
# mark the test as failed before doing anything else
test_status = FAIL
err_trace = self._exc_msg(e)
summary += err_trace
self.log(logging.INFO, "FAIL: " + err_trace)

finally:
stop_time = time.time()
Expand Down

0 comments on commit 8a6567d

Please sign in to comment.