44{-# LANGUAGE NumericUnderscores #-}
55{-# LANGUAGE ScopedTypeVariables #-}
66
7- module Test.Cardano.Api.IPCMock
7+ module Test.Cardano.Api.IPC
88 ( tests
99 )
1010where
@@ -27,7 +27,6 @@ import Lens.Micro ((&))
2727import Network.Socket
2828import Network.Socket.ByteString (sendAll )
2929import System.Directory (removeFile )
30- import System.FilePath ((</>) )
3130
3231import Test.Cardano.Ledger.Common (HasCallStack , when )
3332
@@ -51,7 +50,8 @@ prop_mockInteractionWithNode =
5150 -- We make a query to obtain the current era
5251 eEra <-
5352 mockNode
54- (work </> " ms1" )
53+ work
54+ " ms1"
5555 " test/cardano-api-test/files/input/ipc-mock/server-client-1.raw"
5656 ( \ socketFile ->
5757 H. evalIO $
@@ -84,7 +84,8 @@ prop_mockInteractionWithNode =
8484 -- We make a query to obtain the UTxOs for the given address
8585 eUtxo <-
8686 mockNode
87- (work </> " ms2" )
87+ work
88+ " ms2"
8889 " test/cardano-api-test/files/input/ipc-mock/server-client-2.raw"
8990 ( \ socketFile ->
9091 H. evalIO $
@@ -172,7 +173,8 @@ prop_mockInteractionWithNode =
172173
173174 result <-
174175 mockNode
175- (work </> " ms3" )
176+ work
177+ " ms3"
176178 " test/cardano-api-test/files/input/ipc-mock/server-client-3.raw"
177179 ( \ socketFile ->
178180 H. evalIO $ Api. submitTxToNodeLocal (connectionInfo (File socketFile)) (Api. TxInMode sbe signedTx)
@@ -185,7 +187,7 @@ prop_mockInteractionWithNode =
185187tests :: TestTree
186188tests =
187189 testGroup
188- " Test.Cardano.Api.IPCMock "
190+ " Test.Cardano.Api.IPC "
189191 [ testProperty " Test mock interation with node" prop_mockInteractionWithNode
190192 ]
191193
@@ -209,17 +211,18 @@ mockNode
209211 => FilePath
210212 -- ^ Directory to create the socket file in.
211213 -> FilePath
214+ -- ^ Name of the unix socket file to create
215+ -> FilePath
212216 -- ^ File to read the raw replay data from.
213217 -> (FilePath -> m a )
214218 -- ^ Action to run while the server is being mocked.
215219 -> m a
216- mockNode work rawReplayData action = do
220+ mockNode work fileName rawReplayData action = do
217221 actionFinished :: MVar () <- H. evalIO newEmptyMVar
218222 bracket
219223 -- Server set-up (resource acquisition)
220224 ( do
221- _ <- H. createDirectoryIfMissing work
222- socketFile <- H. noteTempFile work " mock-node.socket"
225+ socketFile <- H. noteTempFile work fileName
223226 sock <- H. evalIO $ do
224227 sock <- socket AF_UNIX Stream defaultProtocol
225228 bind sock (SockAddrUnix socketFile)
0 commit comments