Skip to content
Permalink
Browse files

Make sure process is terminated on failure in Launcher specs

  • Loading branch information...
KtorZ committed Jul 12, 2019
1 parent 39050fd commit f55b1409d5ddc0aa1f5cd9a1d595149c4693cf55
@@ -71,6 +71,7 @@ spec = do
expectPathEventuallyExist d
expectPathEventuallyExist (d <> "/testnet")
expectPathEventuallyExist (d <> "/wallet.db")
`finally` do
terminateProcess ph
TIO.hGetContents o >>= TIO.putStrLn
TIO.hGetContents e >>= TIO.putStrLn
@@ -83,6 +84,7 @@ spec = do
expectPathEventuallyExist d
expectPathEventuallyExist (d <> "/testnet")
expectPathEventuallyExist (d <> "/wallet.db")
`finally` do
terminateProcess ph
TIO.hGetContents o >>= TIO.putStrLn
TIO.hGetContents e >>= TIO.putStrLn
@@ -98,13 +100,15 @@ spec = do
waitForServer @t ctx
let pwd = "passphrase"
(_, out, _) <- createWalletViaCLI @t ctx ["n"] m "\n" pwd
expectValidJSON (Proxy @ApiWallet) out
`finally` do
terminateProcess ph
TIO.hGetContents o >>= TIO.putStrLn
TIO.hGetContents e >>= TIO.putStrLn
expectValidJSON (Proxy @ApiWallet) out
withCreateProcess process $ \_ (Just o) (Just e) ph -> do
waitForServer @t ctx
expectEventually' ctx state Ready wallet `finally` do
expectEventually' ctx state Ready wallet
`finally` do
terminateProcess ph
TIO.hGetContents o >>= TIO.putStrLn
TIO.hGetContents e >>= TIO.putStrLn
@@ -50,6 +50,7 @@ spec = do
let process = proc' (commandName @t) args
withCreateProcess process $ \_ _ _ ph -> do
expectPathEventuallyExist db
`finally` do
terminateProcess ph
threadDelay oneSecond

@@ -87,6 +87,7 @@ spec = do
expectPathEventuallyExist (d <> "/jormungandr")
expectPathEventuallyExist (d <> "/jormungandr-config.json")
expectPathEventuallyExist (d <> "/wallet.db")
`finally` do
terminateProcess ph
TIO.hGetContents o >>= TIO.putStrLn
TIO.hGetContents e >>= TIO.putStrLn
@@ -146,16 +147,18 @@ spec = do
waitForServer @t ctx
let pwd = "passphrase"
(_, out, _) <- createWalletViaCLI @t ctx ["n"] m "\n" pwd
expectValidJSON (Proxy @ApiWallet) out
`finally` do
terminateProcess ph
TIO.hGetContents o >>= TIO.putStrLn
TIO.hGetContents e >>= TIO.putStrLn
expectValidJSON (Proxy @ApiWallet) out
withCreateProcess process $ \_ (Just o) (Just e) ph -> do
waitForServer @t ctx
expectEventually' ctx state Ready wallet `finally` do
terminateProcess ph
TIO.hGetContents o >>= TIO.putStrLn
TIO.hGetContents e >>= TIO.putStrLn
expectEventually' ctx state Ready wallet
`finally` do
terminateProcess ph
TIO.hGetContents o >>= TIO.putStrLn
TIO.hGetContents e >>= TIO.putStrLn

describe "DaedalusIPC" $ do
let defaultArgs =
@@ -11,6 +11,8 @@ import Prelude

import Control.Concurrent
( threadDelay )
import Control.Exception
( finally )
import Control.Monad
( forM_ )
import System.Exit
@@ -53,6 +55,7 @@ spec = do
let process = proc' (commandName @t) args
withCreateProcess process $ \_ _ _ ph -> do
expectPathEventuallyExist db
`finally` do
terminateProcess ph
threadDelay oneSecond

0 comments on commit f55b140

Please sign in to comment.
You can’t perform that action at this time.