From a1cd926b4a51f5ed0dbce012640af219339a9691 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Hurlin?= Date: Tue, 3 Sep 2024 14:23:55 +0200 Subject: [PATCH] cardano-testnet: add golden file for output of query stake-address-info --- .../Cardano/Testnet/Test/Cli/Query.hs | 16 ++++++++++++++++ .../golden/queries/stakeAddressInfoOut.json | 9 +++++++++ 2 files changed, 25 insertions(+) create mode 100644 cardano-testnet/test/cardano-testnet-test/files/golden/queries/stakeAddressInfoOut.json diff --git a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/Query.hs b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/Query.hs index 46d2f4d22e6..1ad6d8e4a11 100644 --- a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/Query.hs +++ b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/Query.hs @@ -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 (, "") ["address", "stakeDelegation", "voteDelegation"])) + stakeAddressInfoOutFile + redactedStakeAddressInfoOutFile + H.diffFileVsGoldenFile + redactedStakeAddressInfoOutFile + "test/cardano-testnet-test/files/golden/queries/stakeAddressInfoOut.json" TestQueryUTxOCmd -> -- utxo diff --git a/cardano-testnet/test/cardano-testnet-test/files/golden/queries/stakeAddressInfoOut.json b/cardano-testnet/test/cardano-testnet-test/files/golden/queries/stakeAddressInfoOut.json new file mode 100644 index 00000000000..d685287c30c --- /dev/null +++ b/cardano-testnet/test/cardano-testnet-test/files/golden/queries/stakeAddressInfoOut.json @@ -0,0 +1,9 @@ +[ + { + "address": "", + "delegationDeposit": 0, + "rewardAccountBalance": 0, + "stakeDelegation": "", + "voteDelegation": "" + } +] \ No newline at end of file