test-sandbox-0.0.1.8: Sandbox for system tests

Safe HaskellNone

Test.Sandbox.Internals

Synopsis

Documentation

newtype Sandbox a Source

Constructors

Sandbox 

Fields

runSandbox :: ErrorT String (ReaderT SandboxStateRef IO) a
 

data SandboxState Source

Constructors

SandboxState 

Fields

ssName :: String
 
ssDataDir :: FilePath
 
ssProcesses :: Map String SandboxedProcess
 
ssProcessOrder :: [String]
 
ssAllocatedPorts :: Map String PortNumber
 
ssAvailablePorts :: [PortNumber]
 
ssFiles :: Map String FilePath
 
ssVariables :: Map String ByteString
 

data SandboxedProcess Source

Constructors

SandboxedProcess 

Fields

spName :: String
 
spBinary :: FilePath
 
spArgs :: [String]
 
spWait :: Maybe Int
 
spCapture :: Maybe Capture
 
spInstance :: Maybe SandboxedProcessInstance
 

data SandboxedProcessInstance Source

Constructors

RunningInstance ProcessHandle Handle (Maybe Handle) 
StoppedInstance ExitCode (Maybe String) 

footer :: StringSource

newSandboxState :: String -> FilePath -> IO SandboxStateRefSource

registerProcess :: String -> FilePath -> [String] -> Maybe Int -> Maybe Capture -> Sandbox SandboxedProcessSource

isValidProcessName :: String -> BoolSource

setFile' :: String -> String -> SandboxState -> IO (FilePath, SandboxState)Source

hReadWithTimeout :: Handle -> Int -> Sandbox ByteStringSource

sendToPort :: String -> String -> Int -> Sandbox StringSource

formatCommandLine :: String -> [String] -> StringSource

hSignalProcess :: Signal -> ProcessHandle -> IO ()Source

killProcess :: ProcessHandle -> IO ()Source

hGetProcessID :: ProcessHandle -> IO ProcessIDSource

interactWithProcess :: SandboxedProcess -> String -> Int -> Sandbox StringSource

findExecutables :: [FilePath] -> IO [FilePath]Source

tryBinary :: FilePath -> IO (Maybe FilePath)Source

expand :: String -> IO StringSource

whenM :: Monad m => m Bool -> m () -> m ()Source

setVariableSource

Arguments

:: Serialize a 
=> String

Variable key for future reference

-> a

Variable value

-> Sandbox a 

Sets a custom variable in the sandbox monad.

checkVariableSource

Arguments

:: String

Variable key

-> Sandbox Bool 

Checks that a custom sandbox variable is set.

getVariableSource

Arguments

:: Serialize a 
=> String

Variable key

-> a

Default value if not found

-> Sandbox a 

Returns the value of a previously set sandbox variable (or a provided default value if unset)

unsetVariableSource

Arguments

:: String

Variable key

-> Sandbox () 

Unsets a custom variable.