tests_fuzz::utils::wait

Function wait_condition_fn

Source
pub async fn wait_condition_fn<F, T, U>(
    timeout: Duration,
    check: F,
    condition: U,
    retry_interval: Duration,
)
where F: Fn() -> BoxFuture<'static, T>, U: Fn(T) -> bool,
Expand description

Waits for a condition to be met by repeatedly checking it within a given timeout period.

This function repeatedly calls the check function and applies the condition function to the result. If the condition is met within the timeout period, the function returns. Otherwise, it waits for the retry interval and checks again, until the timeout period elapses.