Skip to content
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

Fix TraceNodeIsLeader JSON parser #4187

Merged
merged 1 commit into from
Jul 20, 2022

Conversation

jasagredo
Copy link
Contributor

The log messages are formatted slightly different in each case. In particular:

{...,"data":{...,"kind":"TraceAddBlockEvent.AddedToCurrentChain","...},...}

versus

{"...,"data":{...,"val":{"kind":"TraceNodeIsLeader","slot":85}},...}

Also the parser was intended to only get the events with the kind TraceNodeIsLeader.

@jasagredo jasagredo self-assigned this Jul 15, 2022
@jasagredo jasagredo marked this pull request as draft July 15, 2022 15:24
@jasagredo
Copy link
Contributor Author

jasagredo commented Jul 15, 2022

Converted to draft as this doesn't seem to happen on master suprisingly

It does, just that the test is flaky

@jasagredo jasagredo added the bug Something isn't working label Jul 15, 2022
@jasagredo jasagredo force-pushed the jasagredo/fix-testnet-tests-json-parsers branch from b39c168 to 79de6c7 Compare July 19, 2022 10:13
@jasagredo jasagredo marked this pull request as ready for review July 19, 2022 11:40
@jasagredo jasagredo force-pushed the jasagredo/fix-testnet-tests-json-parsers branch from 79de6c7 to d30cc61 Compare July 19, 2022 11:40
@jasagredo
Copy link
Contributor Author

bors r+

iohk-bors bot added a commit that referenced this pull request Jul 19, 2022
4187: Fix `TraceNodeIsLeader` JSON parser r=Jasagredo a=Jasagredo

The log messages are formatted slightly different in each case. In particular:
```
{...,"data":{...,"kind":"TraceAddBlockEvent.AddedToCurrentChain","...},...}
```
versus
```
{"...,"data":{...,"val":{"kind":"TraceNodeIsLeader","slot":85}},...}
```

Also the parser was intended to only get the events with the kind `TraceNodeIsLeader`.

Co-authored-by: Javier Sagredo <jasataco@gmail.com>
@iohk-bors
Copy link
Contributor

iohk-bors bot commented Jul 19, 2022

Build failed:

@jasagredo
Copy link
Contributor Author

bors retry

@iohk-bors
Copy link
Contributor

iohk-bors bot commented Jul 20, 2022

Build succeeded:

@iohk-bors iohk-bors bot merged commit 1f99288 into master Jul 20, 2022
@iohk-bors iohk-bors bot deleted the jasagredo/fix-testnet-tests-json-parsers branch July 20, 2022 10:18
k <- v .: "val" >>= (.: "kind")
if k == "TraceNodeIsLeader"
then TraceNodeIsLeader k <$> (v .: "val" >>= (.: "slot"))
else fail "Not the right kind"
Copy link
Contributor

@Jimbo4350 Jimbo4350 Jul 20, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jasagredo @newhoggy What is the failure "Not the right kind" going to indicate to the user? What is not the right kind? The error message says pretty much nothing.

@jasagredo can you improve this message to something like "Expected kind TraceNodeIsLeader but got: " <> k

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure thing. This is only used in tests though, but yeah, a more informative error message would be better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants