Skip to content

Commit 583152f

Browse files
committed
resolve test input file mainnet-config.json
1 parent ecb34ce commit 583152f

File tree

1 file changed

+19
-25
lines changed

1 file changed

+19
-25
lines changed

cardano-node/test/Test/Cardano/Tracing/NewTracing/Consistency.hs

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ import Cardano.Node.Tracing.Consistency (checkNodeTraceConfiguration)
88

99
import Control.Monad.IO.Class (MonadIO, liftIO)
1010
import Data.Text
11-
import System.FilePath ((</>))
11+
import qualified System.Directory as IO
12+
import System.FilePath (takeFileName, (</>))
1213

1314
import Hedgehog (Property)
1415
import qualified Hedgehog as H
@@ -21,40 +22,33 @@ tests = do
2122
H.checkSequential
2223
$ H.Group "Configuration Consistency tests"
2324
$ Prelude.map test
24-
[ {--( []
25+
[ ( []
2526
-- This file name shoud reference the current standard config with new tracing
2627
-- Add this testcase when hydra has access to a config file with new tracing config
27-
, "mainnet-config.json"
28-
, configPrefix)
29-
,--}
28+
, configSubdir </> "mainnet-config.json"
29+
)
30+
,
3031
( []
31-
, "goodConfig.yaml"
32-
, testPrefix)
32+
, testSubdir </> "goodConfig.yaml"
33+
)
3334
, ( [ "Config namespace error: Illegal namespace ChainDB.CopyToImmutableDBEvent2.CopiedBlockToImmutableDB"
3435
, "Config namespace error: Illegal namespace SubscriptionDNS"
3536
]
36-
, "badConfig.yaml"
37-
, testPrefix)
37+
, testSubdir </> "badConfig.yaml"
38+
)
3839
]
3940
where
40-
test (actualValue, goldenBaseName, prefix) =
41-
(PropertyName goldenBaseName, goldenTestJSON actualValue goldenBaseName prefix)
41+
test (actualValue, goldenBaseName) =
42+
(PropertyName (takeFileName goldenBaseName), goldenTestJSON actualValue goldenBaseName)
4243

43-
44-
goldenTestJSON :: [Text] -> FilePath -> (FilePath -> IO FilePath) -> Property
45-
goldenTestJSON expectedOutcome goldenFileBaseName prefixFunc =
44+
goldenTestJSON :: [Text] -> FilePath -> Property
45+
goldenTestJSON expectedOutcome goldenFileBaseName =
4646
H.withTests 1 $ H.withShrinks 0 $ H.property $ do
47-
basePath <- H.getProjectBase
48-
prefixPath <- liftIO $ prefixFunc basePath
49-
goldenFp <- H.note $ prefixPath </> goldenFileBaseName
47+
base <- H.note =<< H.evalIO . IO.canonicalizePath =<< H.getProjectBase
48+
let goldenFp = base </> goldenFileBaseName
5049
actualValue <- liftIO $ checkNodeTraceConfiguration goldenFp
5150
actualValue H.=== expectedOutcome
5251

53-
54-
-- configPrefix :: FilePath -> IO FilePath
55-
-- configPrefix projectBase = do
56-
-- base <- canonicalizePath projectBase
57-
-- return $ base </> "configuration/cardano/"
58-
59-
testPrefix :: FilePath -> IO FilePath
60-
testPrefix _ = pure "test/Test/Cardano/Tracing/NewTracing/data/"
52+
testSubdir, configSubdir :: FilePath
53+
testSubdir = "cardano-node/test/Test/Cardano/Tracing/NewTracing/data"
54+
configSubdir = "configuration/cardano"

0 commit comments

Comments
 (0)