@@ -6,44 +6,41 @@ module Spec.Chairman.Chairman
6
6
( chairmanOver
7
7
) where
8
8
9
+ import Cardano.Api (unFile )
10
+
9
11
import Cardano.Testnet (TmpAbsolutePath (TmpAbsolutePath ), makeLogDir )
10
12
import qualified Cardano.Testnet as H
11
13
12
14
import Control.Monad (when )
13
15
import Data.Functor ((<&>) )
16
+ import GHC.Stack
14
17
import qualified System.Environment as IO
15
18
import System.Exit (ExitCode (.. ))
16
19
import System.FilePath.Posix ((</>) )
17
20
import qualified System.IO as IO
18
21
import qualified System.Process as IO
19
22
23
+ import Testnet.Types (NodeRuntime , nodeSocketPath )
24
+
20
25
import qualified Hedgehog as H
21
- import Hedgehog.Extras.Stock.IO.Network.Sprocket (Sprocket (.. ))
22
- import qualified Hedgehog.Extras.Stock.IO.Network.Sprocket as IO
23
26
import Hedgehog.Extras.Test.Base (Integration )
24
27
import qualified Hedgehog.Extras.Test.Base as H
25
28
import qualified Hedgehog.Extras.Test.File as H
26
29
import qualified Hedgehog.Extras.Test.Process as H
27
30
28
- {- HLINT ignore "Reduce duplication" -}
29
31
{- HLINT ignore "Redundant <&>" -}
30
- {- HLINT ignore "Redundant flip" -}
31
-
32
- mkSprocket :: FilePath -> FilePath -> String -> Sprocket
33
- mkSprocket tempBaseAbsPath socketDir node = Sprocket tempBaseAbsPath (socketDir </> node)
34
32
35
- chairmanOver :: Int -> Int -> H. Conf -> [String ] -> Integration ()
33
+ chairmanOver :: HasCallStack => Int -> Int -> H. Conf -> [NodeRuntime ] -> Integration ()
36
34
chairmanOver timeoutSeconds requiredProgress H. Conf {H. tempAbsPath} allNodes = do
37
35
maybeChairman <- H. evalIO $ IO. lookupEnv " DISABLE_CHAIRMAN"
38
36
let tempAbsPath' = H. unTmpAbsPath tempAbsPath
39
37
logDir = makeLogDir $ TmpAbsolutePath tempAbsPath'
40
38
tempBaseAbsPath = H. makeTmpBaseAbsPath $ TmpAbsolutePath tempAbsPath'
41
- socketDir = H. makeSocketDir $ TmpAbsolutePath tempAbsPath'
42
39
when (maybeChairman /= Just " 1" ) $ do
43
40
nodeStdoutFile <- H. noteTempFile logDir $ " chairman" <> " .stdout.log"
44
41
nodeStderrFile <- H. noteTempFile logDir $ " chairman" <> " .stderr.log"
45
42
46
- sprockets <- H. noteEach $ fmap (mkSprocket tempBaseAbsPath socketDir) allNodes
43
+ sprockets <- H. noteEach $ unFile . nodeSocketPath <$> allNodes
47
44
48
45
hNodeStdout <- H. evalIO $ IO. openFile nodeStdoutFile IO. WriteMode
49
46
hNodeStderr <- H. evalIO $ IO. openFile nodeStderrFile IO. WriteMode
@@ -54,7 +51,7 @@ chairmanOver timeoutSeconds requiredProgress H.Conf {H.tempAbsPath} allNodes = d
54
51
, " --config" , tempAbsPath' </> " configuration.yaml"
55
52
, " --require-progress" , show @ Int requiredProgress
56
53
]
57
- <> (sprockets >>= (\ sprocket -> [" --socket-path" , IO. sprocketArgumentName sprocket]))
54
+ <> (sprockets >>= (\ sprocket -> [" --socket-path" , sprocket]))
58
55
) <&>
59
56
( \ cp -> cp
60
57
{ IO. std_in = IO. CreatePipe
0 commit comments