convex-devnet-0.2.0.0: Devnet for integration tests
Safe HaskellSafe-Inferred
LanguageHaskell2010

Convex.Devnet.Utils

Synopsis

Documentation

withLogFileFilePath → (HandleIO a) → IO a Source #

Open given log file non-buffered in append mode and print a message with filepath to stderr on exceptions.

checkProcessHasNotDiedTextProcessHandleIO Void Source #

Wait for process termination and do failure on non-zero exit code. This function is useful for end-to-end testing of external processes esp. in conjunction with race combinator:

@ withCreateProcess p $ _stdin _stdout _stderr processHandle -> do race_ (checkProcessHasNotDied "my-process" processHandle) doStuff @

failure ∷ (HasCallStack, MonadThrow m) ⇒ String → m a Source #

Fails a test with given error message. This function improves over existing expectationFailure by throwing a HUnitFailure exception containig the location of the error and providing better callstack context.

readConfigFileFilePathIO ByteString Source #

Lookup a config file similar reading a file from disk.

createSystemTempDirectoryStringIO FilePath Source #

Create a unique temporary directory.

withTempDirMonadIO m ⇒ String → (FilePath → m r) → m r Source #

Create a temporary directory for the given action to use. The directory is removed if and only if the action completes successfuly.

failAfter ∷ (HasCallStack, MonadTimer m, MonadThrow m) ⇒ DiffTime → m a → m a Source #

Fail some monadic action if it does not complete within given timeout. A DiffTime can be represented as a decimal number of seconds.