@@ -6,44 +6,41 @@ module Spec.Chairman.Chairman
66 ( chairmanOver
77 ) where
88
9+ import Cardano.Api (unFile )
10+
911import Cardano.Testnet (TmpAbsolutePath (TmpAbsolutePath ), makeLogDir )
1012import qualified Cardano.Testnet as H
1113
1214import Control.Monad (when )
1315import Data.Functor ((<&>) )
16+ import GHC.Stack
1417import qualified System.Environment as IO
1518import System.Exit (ExitCode (.. ))
1619import System.FilePath.Posix ((</>) )
1720import qualified System.IO as IO
1821import qualified System.Process as IO
1922
23+ import Testnet.Types (NodeRuntime , nodeSocketPath )
24+
2025import qualified Hedgehog as H
21- import Hedgehog.Extras.Stock.IO.Network.Sprocket (Sprocket (.. ))
22- import qualified Hedgehog.Extras.Stock.IO.Network.Sprocket as IO
2326import Hedgehog.Extras.Test.Base (Integration )
2427import qualified Hedgehog.Extras.Test.Base as H
2528import qualified Hedgehog.Extras.Test.File as H
2629import qualified Hedgehog.Extras.Test.Process as H
2730
28- {- HLINT ignore "Reduce duplication" -}
2931{- HLINT ignore "Redundant <&>" -}
30- {- HLINT ignore "Redundant flip" -}
31-
32- mkSprocket :: FilePath -> FilePath -> String -> Sprocket
33- mkSprocket tempBaseAbsPath socketDir node = Sprocket tempBaseAbsPath (socketDir </> node)
3432
35- chairmanOver :: Int -> Int -> H. Conf -> [String ] -> Integration ()
33+ chairmanOver :: HasCallStack => Int -> Int -> H. Conf -> [NodeRuntime ] -> Integration ()
3634chairmanOver timeoutSeconds requiredProgress H. Conf {H. tempAbsPath} allNodes = do
3735 maybeChairman <- H. evalIO $ IO. lookupEnv " DISABLE_CHAIRMAN"
3836 let tempAbsPath' = H. unTmpAbsPath tempAbsPath
3937 logDir = makeLogDir $ TmpAbsolutePath tempAbsPath'
4038 tempBaseAbsPath = H. makeTmpBaseAbsPath $ TmpAbsolutePath tempAbsPath'
41- socketDir = H. makeSocketDir $ TmpAbsolutePath tempAbsPath'
4239 when (maybeChairman /= Just " 1" ) $ do
4340 nodeStdoutFile <- H. noteTempFile logDir $ " chairman" <> " .stdout.log"
4441 nodeStderrFile <- H. noteTempFile logDir $ " chairman" <> " .stderr.log"
4542
46- sprockets <- H. noteEach $ fmap (mkSprocket tempBaseAbsPath socketDir) allNodes
43+ sprockets <- H. noteEach $ unFile . nodeSocketPath <$> allNodes
4744
4845 hNodeStdout <- H. evalIO $ IO. openFile nodeStdoutFile IO. WriteMode
4946 hNodeStderr <- H. evalIO $ IO. openFile nodeStderrFile IO. WriteMode
@@ -54,7 +51,7 @@ chairmanOver timeoutSeconds requiredProgress H.Conf {H.tempAbsPath} allNodes = d
5451 , " --config" , tempAbsPath' </> " configuration.yaml"
5552 , " --require-progress" , show @ Int requiredProgress
5653 ]
57- <> (sprockets >>= (\ sprocket -> [" --socket-path" , IO. sprocketArgumentName sprocket]))
54+ <> (sprockets >>= (\ sprocket -> [" --socket-path" , sprocket]))
5855 ) <&>
5956 ( \ cp -> cp
6057 { IO. std_in = IO. CreatePipe
0 commit comments