cardano-cli:cardano-cli-test-lib
Safe HaskellNone
LanguageHaskell2010

Test.Cardano.CLI.Util

Synopsis

Documentation

assertDirectoryMissing :: (MonadTest m, MonadIO m, HasCallStack) => FilePath -> m () Source #

Asserts that the given directory is missing.

checkTxCddlFormat Source #

Arguments

:: (MonadTest m, MonadIO m, HasCallStack) 
=> FilePath

Reference/golden file

-> FilePath

Newly created file

-> m () 

checkTextEnvelopeFormat :: (MonadTest m, MonadIO m, HasCallStack) => TextEnvelopeType -> FilePath -> FilePath -> m () Source #

Checks that the tvType and tvDescription are equivalent between two files.

equivalence :: (MonadTest m, Eq a, Show a, HasCallStack) => a -> a -> m () Source #

Check for equivalence between two types and perform a file cleanup on failure.

execCardanoCLI Source #

Arguments

:: (MonadTest m, MonadCatch m, MonadIO m, HasCallStack) 
=> [String]

Arguments to the CLI command

-> m String

Captured stdout

Execute cardano-cli via the command line.

Waits for the process to finish and returns the stdout.

execCardanoCLIWithEnvVars Source #

Arguments

:: (MonadTest m, MonadCatch m, MonadIO m, HasCallStack) 
=> [(String, String)]

Environment variables to set

-> [String]

Arguments to the CLI command

-> m String 

Execute cardano-cli via the command line but set environment variables. Fails if the process returns a non-zero exit code.

Waits for the process to finish and returns the stdout.

execDetailCardanoCLI Source #

Arguments

:: (MonadTest m, MonadCatch m, MonadIO m, HasCallStack) 
=> [String]

Arguments to the CLI command

-> m (ExitCode, String, String)

Captured stdout

Execute cardano-cli via the command line, expecting it to fail.

Waits for the process to finish and returns the exit code, stdout and stderr.

execDetailConfigCardanoCLI Source #

Arguments

:: (MonadTest m, MonadCatch m, MonadIO m, HasCallStack) 
=> ExecConfig

Configuration for the execution

-> [String]

Arguments to the CLI command

-> m (ExitCode, String, String)

Captured stdout

Execute cardano-cli via the command line, expecting it to fail, and accepting custom config.

Waits for the process to finish and returns the exit code, stdout and stderr.

tryExecCardanoCLI Source #

Arguments

:: [String]

Arguments to the CLI command

-> PropertyT IO (Either Failure String)

Captured stdout, or error in case of failures

withSnd :: (a -> b) -> a -> (a, b) Source #

Return the supply value with the result of the supplied function as a tuple

noteInputFile :: (MonadTest m, HasCallStack) => FilePath -> m FilePath Source #

Return the input file path after annotating it relative to the project root directory

noteTempFile :: (MonadTest m, HasCallStack) => FilePath -> FilePath -> m FilePath Source #

Return the test file path after annotating it relative to the project root directory

bracketSem Source #

Arguments

:: MonadBaseControl IO m 
=> FileSem

a file semaphore

-> (FilePath -> m c)

an action, a file path will be extracted from the semaphore

-> m c 

Run action acquiring a semaphore, and releasing afterwards. Guards against concurrent access to a block of code.

data FileSem Source #

A file semaphore protecting against a concurrent path access

Instances

Instances details
Show FileSem Source # 
Instance details

Defined in Test.Cardano.CLI.Util

Pretty FileSem Source # 
Instance details

Defined in Test.Cardano.CLI.Util

Methods

pretty :: FileSem -> Doc ann Source #

prettyList :: [FileSem] -> Doc ann Source #

newFileSem Source #

Arguments

:: FilePath

path to be guarded by a semaphore allowing only one concurrent to access it

-> FileSem 

Create new file semaphore. Always use with NOINLINE pragma! Example: createTestnetDataOutSem :: FileSem createTestnetDataOutSem = newFileSem "testcardano-cli-goldenfilesgoldenconway/create-testnet-data.out" {-# NOINLINE createTestnetDataOutSem #-}

expectFailure :: HasCallStack => TestT IO m -> PropertyT IO () Source #

Invert the behavior of a MonadTest: success becomes failure and vice versa.