Skip to content

Commit

Permalink
cardano-node: Add mainnet config test case
Browse files Browse the repository at this point in the history
  • Loading branch information
jutaro committed Dec 6, 2024
1 parent 456b040 commit 495634a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
2 changes: 1 addition & 1 deletion cardano-node/src/Cardano/Node/Run.hs
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,7 @@ updateBlockForging startupTracer blockType nodeKernel nc = do
(BlockForgingUpdate (if isNonProducing || null blockForging
then DisabledBlockForging
else EnabledBlockForging))
unless (ncStartAsNonProducingNode nc) $
unless isNonProducing $
setBlockForging nodeKernel blockForging
Nothing ->
traceWith startupTracer
Expand Down
29 changes: 17 additions & 12 deletions cardano-node/test/Test/Cardano/Tracing/NewTracing/Consistency.hs
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,32 @@ tests = H.checkSequential
$ H.Group "Configuration Consistency tests"
$ test
<$> [ ( []
, "goodConfig.yaml")
, "mainnet-config-new-tracing.json"
, configPrefix)
, ( []
, "goodConfig.yaml"
, testPrefix)
, ( [ "Config namespace error: Illegal namespace ChainDB.CopyToImmutableDBEvent2.CopiedBlockToImmutableDB"
, "Config namespace error: Illegal namespace SubscriptionDNS"
]
, "badConfig.yaml")
-- TODO: add mainnet config as good
, "badConfig.yaml"
, testPrefix)
]
where
test (actualValue, goldenBaseName) =
(PropertyName goldenBaseName, goldenTestJSON actualValue goldenBaseName)
test (actualValue, goldenBaseName, prefix) =
(PropertyName goldenBaseName, goldenTestJSON actualValue goldenBaseName prefix)


goldenTestJSON :: [Text] -> FilePath -> Property
goldenTestJSON expectedOutcome goldenFileBaseName =
goldenTestJSON :: [Text] -> FilePath -> FilePath -> Property
goldenTestJSON expectedOutcome goldenFileBaseName prefix =
H.withTests 1 $ H.withShrinks 0 $ H.property $ do
goldenFp <- H.Base.note $ addPrefix goldenFileBaseName
goldenFp <- H.Base.note $ prefix <> goldenFileBaseName
actualValue <- liftIO $ checkNodeTraceConfiguration goldenFp
actualValue H.=== expectedOutcome


-- | NB: this function is only used in 'goldenTestJSON' but it is defined at the
-- top level so that we can refer to it in the documentation of this module.
addPrefix :: FilePath -> FilePath
addPrefix fname = "test/Test/Cardano/Tracing/NewTracing/data/" <> fname
configPrefix :: FilePath
configPrefix = "../configuration/cardano/"

testPrefix :: FilePath
testPrefix = "test/Test/Cardano/Tracing/NewTracing/data/"

0 comments on commit 495634a

Please sign in to comment.