rptest/util: add check_consistently() safety helper#31013
Open
nvartolomei wants to merge 2 commits into
Open
Conversation
b64870f to
bed5f0f
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new safety-style polling helper to the rptest test utilities, intended to assert a condition remains true over a time window (as a complement to wait_until’s eventual-true behavior).
Changes:
- Add
check_consistently()totests/rptest/util.pyfor “condition must stay true” assertions over a duration. - Add ducktape unit-style tests for the helper in
tests/rptest/util_test.py. - Minor formatting-only adjustments to a couple of existing lambdas for readability.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| tests/rptest/util.py | Introduces check_consistently() and adjusts formatting in a couple of call sites. |
| tests/rptest/util_test.py | Adds ducktape tests intended to validate check_consistently() behavior. |
The inverse of wait_until: assert a condition holds for the whole duration window instead of waiting for it to become true, failing fast with AssertionError the moment it breaks.
bed5f0f to
7880fc6
Compare
Collaborator
Retry command for Build#86711please wait until all jobs are finished before running the slash command |
Collaborator
CI test resultstest results on build#86711
test results on build#86757
|
Contributor
Author
|
/ci-repeat 1 |
Raise ConditionNotHeldError, a subclass of AssertionError, so callers can catch the specific failure while still treating it as an assertion.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
check_consistently()torptest.util, the safety counterpart towait_until's liveness check. Wherewait_untilblocks until a conditionbecomes true,
check_consistentlyasserts a condition stays true for the wholeduration window and fails fast with
AssertionErrorthe moment it breaks.The docstring calls out the failure mode of safety assertions (too short a
window yields a meaningless pass) and recommends pairing them with a positive
control. Unit tests in
util_test.pycover the hold, slow-poll, andbecomes-false paths.
Backports Required
Release Notes