Introduce ValidationFailureError and add an optional 'failure_values' parameter to validate_equals_with_retry. This enables early termination when a known failure value is observed (e.g., "failed", "aborted"), instead of continuing to poll until timeout. The feature is particularly useful for tests that wait on long-running operations where certain states unambiguously indicate failure, allowing the test to fail quickly and save execution time. The implementation includes defensive input validation to reject common misuse (e.g., passing a raw string instead of a sequence). The change is fully backward compatible: existing calls without the failure_values parameter behave exactly as before. Complex failure conditions can still be expressed by raising an exception inside the provided callable. Change-Id: Ia66f9231ca4cb66c86b715d629fa7354cf6ad293 Signed-off-by: Andrew Vaillancourt <andrew.vaillancourt@windriver.com>
5 lines
150 B
Python
5 lines
150 B
Python
class ValidationFailureError(RuntimeError):
|
|
"""Raised when validation detects an explicit failure condition during retry operations."""
|
|
|
|
pass
|