Skip to content

Commit

Permalink
Merge pull request #5970 from IntersectMBO/smelc/check-query-stake-ad…
Browse files Browse the repository at this point in the history
…dress-info-output

cardano-testnet: make call to query stake-address-info a golden test
  • Loading branch information
smelc authored Sep 5, 2024
2 parents 5debb0f + a1cd926 commit b17e1d2
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -269,12 +269,28 @@ hprop_cli_queries = integrationWorkspace "cli-queries" $ \tempAbsBasePath' -> H.
TestQueryStakeAddressInfoCmd ->
-- stake-address-info
do
-- to stdout
let delegatorKeys = Defaults.defaultDelegatorStakeKeyPair 1
delegatorVKey :: VerificationKey StakeKey <- readVerificationKeyFromFile AsStakeKey work $ verificationKey delegatorKeys
let stakeAddress :: StakeAddress = verificationStakeKeyToStakeAddress testnetMagic delegatorVKey
H.noteM_ $ execCli' execConfig [ eraName, "query", "stake-address-info"
, "--address", T.unpack $ serialiseAddress stakeAddress
]
-- to a file
let stakeAddressInfoOutFile = work </> "stake-address-info-out.json"
redactedStakeAddressInfoOutFile = work </> "stake-address-info-out-redacted.json"
H.noteM_ $ execCli' execConfig [ eraName, "query", "stake-address-info"
, "--address", T.unpack $ serialiseAddress stakeAddress
, "--out-file", stakeAddressInfoOutFile
]

redactJsonFieldsInFile
(fromList (map (, "<redacted>") ["address", "stakeDelegation", "voteDelegation"]))
stakeAddressInfoOutFile
redactedStakeAddressInfoOutFile
H.diffFileVsGoldenFile
redactedStakeAddressInfoOutFile
"test/cardano-testnet-test/files/golden/queries/stakeAddressInfoOut.json"

TestQueryUTxOCmd ->
-- utxo
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[
{
"address": "<redacted>",
"delegationDeposit": 0,
"rewardAccountBalance": 0,
"stakeDelegation": "<redacted>",
"voteDelegation": "<redacted>"
}
]

0 comments on commit b17e1d2

Please sign in to comment.