-
Notifications
You must be signed in to change notification settings - Fork 720
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add cardano-testnet queries test: gov-state, stake-distribution #5803
Add cardano-testnet queries test: gov-state, stake-distribution #5803
Conversation
fd3efd4
to
8fef808
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll approve as the last commit looks good but the first commit needs a couple of changes I described in the other PR.
_ :: Aeson.Value <- H.leftFailM . H.readJsonFile $ drepStateOutFile | ||
|
||
-- protocol-parameters | ||
do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This do
is mainly for style purposes right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, just to visually separate each query
let tipOutFile = work </> "tip-out.json" | ||
H.noteM_ $ H.execCli' execConfig [ eraName, "query", "tip" | ||
, "--out-file", tipOutFile] | ||
_ :: QueryTipLocalStateOutput <- H.readJsonFileOk tipOutFile |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we use a bang pattern here to be sure we are actually decoding the file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That should be done by readJsonFileOk
which lifts the Either DecodeError QueryTipLocalStateOutput
to MonadTest m => m QueryTipLocalStateOutput
, so it should error out at this place already.
-- to stdout | ||
stakeDistrOut <- H.execCli' execConfig [ eraName, "query", "stake-distribution" ] | ||
-- stake addresses with stake | ||
let stakeAddresses = map (both T.strip . T.breakOn " " . T.strip . fromString) . drop 2 . lines $ stakeDistrOut |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this not return JSON?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when writing to a file - yes. When writing to stdout, nope, plain text.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's not good, I'll fix that: IntersectMBO/cardano-cli#739
|
||
H.success | ||
|
||
both :: (a -> b) -> (a, a) -> (b, b) | ||
both f ~(x, y) = (f x, f y) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if bimap T.strip T.strip
is more readable than both T.stip
but I don't mind using it instead.
cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/Queries.hs
Outdated
Show resolved
Hide resolved
7dafede
to
49f08af
Compare
49f08af
to
d608966
Compare
Macos & windows failures are unrelated to this PR - there's an issue with the base image. |
Description
Add cardano-testnet queries test: gov-state, stake-distribution
Part of fixing #5672
Checklist
See Runnings tests for more details
CHANGELOG.md
for affected package.cabal
files are updatedhlint
. See.github/workflows/check-hlint.yml
to get thehlint
versionstylish-haskell
. See.github/workflows/stylish-haskell.yml
to get thestylish-haskell
versionghc-8.10.7
andghc-9.2.7
Note on CI
If your PR is from a fork, the necessary CI jobs won't trigger automatically for security reasons.
You will need to get someone with write privileges. Please contact IOG node developers to do this
for you.