sandwich-0.3.0.3: Yet another test framework for Haskell
Safe HaskellSafe-Inferred
LanguageHaskell2010

Test.Sandwich.Waits

Description

This module contains helper functions for waiting.

It can be very useful in tests to retry something, with a reasonable backoff policy to prevent the test from consuming lots of CPU while waiting.

Synopsis

General waits

waitUntil :: forall m a. (HasCallStack, MonadUnliftIO m) => Double -> m a -> m a Source #

Keep trying an action up to a timeout while it fails with a FailureReason. Use exponential backoff, with delays capped at 1 second.

waitUntil' :: forall m a. (HasCallStack, MonadUnliftIO m) => RetryPolicy -> Double -> m a -> m a Source #

Same as waitUntil, but with a configurable retry policy.

defaultRetryPolicy :: RetryPolicy Source #

The default retry policy.