Skip to content

Commit 602d5ec

Browse files
authored
Merge pull request #5961 from IntersectMBO/smelc/check-query-drep-stake-distribution-value
cardano-testnet: test value delegated to dreps in test of drep-stake-distribution
2 parents d113bdc + de5e092 commit 602d5ec

File tree

1 file changed

+13
-3
lines changed
  • cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli

1 file changed

+13
-3
lines changed

cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/Query.hs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import Cardano.Api
1717
import qualified Cardano.Api.Genesis as Api
1818
import Cardano.Api.Ledger (Coin (Coin), EpochInterval (EpochInterval), StandardCrypto,
1919
extractHash, unboundRational)
20+
import qualified Cardano.Api.Ledger as L
2021
import Cardano.Api.Shelley (StakeCredential (StakeCredentialByKey), StakePoolKey)
2122

2223
import Cardano.CLI.Types.Key (VerificationKeyOrFile (VerificationKeyFilePath),
@@ -385,9 +386,18 @@ hprop_cli_queries = integrationWorkspace "cli-queries" $ \tempAbsBasePath' -> H.
385386
drepStateRedactedOutFile
386387
"test/cardano-testnet-test/files/golden/queries/drepStateOut.json"
387388

388-
TestQueryDRepStakeDistributionCmd ->
389+
TestQueryDRepStakeDistributionCmd -> do
389390
-- drep-stake-distribution
390-
H.noteM_ $ execCli' execConfig [ eraName, "query", "drep-stake-distribution", "--all-dreps" ]
391+
-- to stdout
392+
drepStakeDistribution :: [(L.DRep StandardCrypto, L.Coin)] <- H.noteShowM $ execCliStdoutToJson execConfig [ eraName, "query", "drep-stake-distribution", "--all-dreps" ]
393+
394+
-- TODO: we could check that the Coin amount below is the one reported
395+
-- by query stake-address-info
396+
397+
H.assertWith drepStakeDistribution $ \dreps ->
398+
length dreps == 3 -- Because, by default, 3 DReps are created
399+
400+
forM_ drepStakeDistribution $ \(_drep, coin) -> Coin 15_000_003_000_000 H.=== coin
391401

392402
TestQueryCommitteeMembersStateCmd ->
393403
-- committee-state
@@ -491,4 +501,4 @@ redactJsonFields changes v =
491501
Aeson.Array $ Vector.map recurse vector
492502
_ -> v
493503
where
494-
recurse = redactJsonFields changes
504+
recurse = redactJsonFields changes

0 commit comments

Comments
 (0)