Skip to content

Commit

Permalink
Merge pull request #6096 from IntersectMBO/smelc/testnet-call-cli-che…
Browse files Browse the repository at this point in the history
…ck-node-configuration

cardano-testnet: call the CLI check-node-configuration to catch configuration errors
  • Loading branch information
smelc authored and Icelandjack committed Feb 5, 2025
2 parents 77efb66 + 5697558 commit f1c91e5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
11 changes: 9 additions & 2 deletions cardano-node/src/Cardano/Node/Startup.hs
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,16 @@ prepareNodeInfo nc (SomeConsensusProtocol whichP pForInfo) tc nodeStartTime = do
-- In this case we should form node's name as "host_port",
-- where 'host' is the machine's host name and 'port' is taken
-- from the '--port' CLI-parameter.
let SocketConfig{ncNodePortNumber = port} = ncSocketConfig nc

let suffix :: Text
suffix
| SocketConfig{ncNodePortNumber = Last (Just port)} <- ncSocketConfig nc
= "_" <> show port
| otherwise
= ""

hostName <- getHostName
return . pack $ hostName <> "_" <> show (getLast port)
return (pack (hostName <> suffix))

-- | This information is taken from 'BasicInfoShelleyBased'. It is required for
-- 'cardano-tracer' service (particularly, for RTView).
Expand Down
4 changes: 4 additions & 0 deletions cardano-testnet/src/Testnet/Start/Cardano.hs
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,10 @@ cardanoTestnet
-- Add Byron, Shelley and Alonzo genesis hashes to node configuration
config <- createConfigJson (TmpAbsolutePath tmpAbsPath) sbe
H.evalIO $ LBS.writeFile (unFile configurationFile) config
execCli_
[ "debug", "check-node-configuration"
, "--node-configuration-file", unFile configurationFile
]

portNumbersWithNodeOptions <- forM cardanoNodes $ \nodeOption -> (nodeOption,) <$> H.randomPort testnetDefaultIpv4Address
let portNumbers = snd <$> portNumbersWithNodeOptions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ computeRoutes TracerEnv{teConnectedNodesNames, teAcceptedMetrics} = atomically d
pure (RouteDictionary routes)



contentHdrJSON, contentHdrOpenMetrics, contentHdrUtf8Html, contentHdrUtf8Text :: ResponseHeaders
contentHdrJSON = [(hContentType, "application/json")]
contentHdrOpenMetrics = [(hContentType, "application/openmetrics-text; version=1.0.0; charset=utf-8")]
Expand Down

0 comments on commit f1c91e5

Please sign in to comment.