hydra-node
Safe HaskellSafe-Inferred
LanguageGHC2021

Test.Util

Synopsis

Documentation

noopCallback :: Applicative m => NetworkCallback msg m Source #

shouldRunInSim :: (forall s. IOSim s a) -> IO a Source #

Run given action in IOSim and rethrow any exceptions.

printTrace :: forall log a. (Typeable log, ToJSON log) => Proxy log -> SimTrace a -> Text Source #

Utility function to dump logs given a SimTrace.

shouldBe :: (HasCallStack, MonadThrow m, Eq a, Show a) => a -> a -> m () Source #

Lifted variant of Hspec's shouldBe.

shouldSatisfy :: (HasCallStack, MonadThrow m, Show a) => a -> (a -> Bool) -> m () Source #

Lifted variant of Hspec's shouldSatisfy.

traceInIOSim :: Typeable a => Tracer (IOSim s) a Source #

A Tracer that works in IOSim monad. This tracer uses the Output event which uses converts value traced to Dynamic which requires Typeable constraint. To retrieve the trace use selectTraceEventsDynamic applied to the correct type.

traceDebug :: (Applicative m, ToJSON a) => Tracer m a Source #

Useful when one needs to also trace logs to stderr. Thanks to the monoidal nature of Tracer it's straightforward to add this to any existing tracer:

@ someCode tracer = do foo <- makeFoo withTracer (tr <> traceDebug) SomeTraceFoo ... @

propCollisionResistant :: (Show a, Eq a) => String -> Gen a -> Spec Source #

This creates an hspec test case about a property which ensures the given generator does not produce equals values within a reasonable number of generated values.

isContinuous :: (Eq a, Enum a) => [a] -> Bool Source #

Predicate which decides whether given list is continuous.

isStrictlyMonotonic :: Ord a => [a] -> Bool Source #

Predicate which decides whether given list is strictly monotonic.

waitEq :: (HasCallStack, Eq a, Show a) => IO a -> NominalDiffTime -> a -> IO () Source #

Wait up to some time for a function to yield an equal value.

waitMatch :: (HasCallStack, Show a) => IO a -> NominalDiffTime -> (a -> Maybe b) -> IO b Source #

Wait up to some time for a function to return a value that satisfies given predicate.

captureTracer :: Text -> IO (Tracer IO a, IO [Envelope a]) Source #

Create a tracer that captures all messages and a function to retrieve all traces captured. XXX: This is duplicated in MithrilSpec in hydra-cluster, but can't (easily) be moved to the Test Prelude because of the dependency on Hydra.Logging.

utxoNoThunks :: UTxO -> IO (Maybe ThunkInfo) Source #

Check a UTxO for thunks, descending via constructors so that GADT dictionary fields (e.g. the Eq/Show context stored inside TxOutValueShelleyBased) are not reported as false positives, as they would be by a whole-value InspectHeap probe.

txOutNoThunks :: TxOut CtxUTxO -> IO (Maybe ThunkInfo) Source #

scriptLanguageNoThunks :: ScriptLanguage lang -> IO (Maybe ThunkInfo) Source #

scriptNoThunks :: Script lang -> IO (Maybe ThunkInfo) Source #