Skip to content

Commit

Permalink
create-testnet-data: add negative test of checking of genesis hash
Browse files Browse the repository at this point in the history
  • Loading branch information
smelc committed Sep 26, 2024
1 parent 1409685 commit d0ae0cd
Show file tree
Hide file tree
Showing 2 changed files with 116 additions and 0 deletions.
24 changes: 24 additions & 0 deletions cardano-cli/test/cardano-cli-test/Test/Cli/CreateTestnetData.hs
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,27 @@ hprop_create_testnet_data_transient_stake_delegators =

-- For the golden part of this test, we are anyway covered by 'hprop_golden_create_testnet_data'
-- that generates strictly more stuff.

-- Execute this test with:
-- @cabal test cardano-cli-test --test-options '-p "/create testnet wrong genesis hash/"'@
hprop_create_testnet_wrong_genesis_hash :: Property
hprop_create_testnet_wrong_genesis_hash =
propertyOnce $ moduleWorkspace "tmp" $ \tempDir -> do
let outputDir = tempDir </> "out"

(exitCode, _stdout, stderr) <-
H.noteShowM $
execDetailCardanoCLI
[ "conway"
, "genesis"
, "create-testnet-data"
, "--testnet-magic"
, "42"
, "--node-configuration"
, "test/cardano-cli-test/files/input/conway/create-testnet-data/./node-config.json"
, "--out-dir"
, outputDir
]

exitCode === ExitFailure 1
H.assertWith stderr ("Hash associated to key \"ConwayGenesisHash\" in file" `isInfixOf`)
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
{
"AlonzoGenesisHash": "dbc03856c313ce69b7bbcaebcc775347cc8434b0333f67f0b744a359fab16eae",
"ByronGenesisHash": "3b580098c978f3f8654768e963ccabf1d6575480bd7ae18b6891d16f5ceeacea",
"ConwayGenesisHash": "b632b8469ea7d7ae8a66e5d1419f2992764eb6f1527c39aeaef2525f3d3fa5a9",
"EnableLogMetrics": false,
"EnableLogging": true,
"EnableP2P": false,
"ExperimentalHardForksEnabled": true,
"ExperimentalProtocolsEnabled": true,
"LastKnownBlockVersion-Alt": 0,
"LastKnownBlockVersion-Major": 2,
"LastKnownBlockVersion-Minor": 0,
"MaxConcurrencyBulkSync": 1,
"MaxConcurrencyDeadline": 2,
"PBftSignatureThreshold": 0.6,
"Protocol": "Cardano",
"RequiresNetworkMagic": "RequiresMagic",
"ShelleyGenesisHash": "00e8783a023250284b547e6d27c081c044424b56350bc5c83d95dc368efe7805",
"SocketPath": "db/node.socket",
"TestShelleyHardForkAtEpoch": 0,
"TraceBlockFetchClient": false,
"TraceBlockFetchDecisions": false,
"TraceBlockFetchProtocol": false,
"TraceBlockFetchProtocolSerialised": false,
"TraceBlockFetchServer": false,
"TraceBlockchainTime": true,
"TraceChainDb": true,
"TraceChainSyncBlockServer": false,
"TraceChainSyncClient": false,
"TraceChainSyncHeaderServer": false,
"TraceChainSyncProtocol": false,
"TraceConnectionManager": true,
"TraceDnsResolver": true,
"TraceDnsSubscription": true,
"TraceErrorPolicy": true,
"TraceForge": true,
"TraceHandshake": false,
"TraceIpSubscription": true,
"TraceLocalChainSyncProtocol": false,
"TraceLocalConnectionManager": false,
"TraceLocalErrorPolicy": true,
"TraceLocalHandshake": false,
"TraceLocalRootPeers": true,
"TraceLocalServer": false,
"TraceLocalTxSubmissionProtocol": false,
"TraceLocalTxSubmissionServer": false,
"TraceMempool": true,
"TraceMux": false,
"TracePeerSelection": true,
"TracePeerSelectionActions": true,
"TracePublicRootPeers": true,
"TraceServer": true,
"TraceTxInbound": false,
"TraceTxOutbound": false,
"TraceTxSubmissionProtocol": false,
"TurnOnLogMetrics": false,
"defaultBackends": [
"KatipBK"
],
"defaultScribes": [
[
"FileSK",
"logs/mainnet.log"
],
[
"StdoutSK",
"stdout"
]
],
"minSeverity": "Debug",
"options": {},
"rotation": {
"rpKeepFilesNum": 3,
"rpLogLimitBytes": 5000000,
"rpMaxAgeHours": 24
},
"setupBackends": [
"KatipBK"
],
"setupScribes": [
{
"scFormat": "ScJson",
"scKind": "FileSK",
"scName": "logs/node.log"
},
{
"scFormat": "ScJson",
"scKind": "StdoutSK",
"scName": "stdout"
}
]
}

0 comments on commit d0ae0cd

Please sign in to comment.