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

Generator of Tendermint types for unit, integration, and model-based testing #468

Merged
merged 70 commits into from
Jul 29, 2020

Conversation

andrey-kuprianov
Copy link
Contributor

Here we introduce both the code-level helpers for generating tendermint object hierarchies in tests, as well as the command-line generator of those hierarchies.

For the high-level explanation please see #393.

This is still a WIP, but as it is already usable it probably makes sense to merge now, and then extend in separate PRs/issues.

Will be grateful for your reviews!

  • Referenced an issue explaining the need for the change
  • Updated all relevant documentation in docs
  • Updated all code comments where relevant
  • Wrote tests
  • Updated CHANGES.md

* refactor produce_validator to allow calling it from within Rust code,
to easily produce Info struct
* add --ignore-stdin option to allow skipping parsing from STDIN
@romac
Copy link
Member

romac commented Jul 22, 2020

Just want to emphasize how good the CLI interface is by the way:

    tendermint-testgen validator --id a --voting-power 3
     echo -n '{"id": "a", "voting_power": 3}' | tendermint-testgen --stdin validator
     echo -n a | tendermint-testgen --stdin validator --voting-power 3
     echo -n '{"id": "a"}' | tendermint-testgen --stdin validator --voting-power 3
     echo -n '{"id": "a", "voting_power": 100}' | tendermint-testgen --stdin validator --voting-power 3

😍

Co-authored-by: Romain Ruetschi <[email protected]>
Copy link
Member

@romac romac left a comment

Choose a reason for hiding this comment

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

Few more comments on things I missed in my first pass.

tendermint-testgen/src/helpers.rs Outdated Show resolved Hide resolved
tendermint-testgen/src/helpers.rs Outdated Show resolved Hide resolved
@andrey-kuprianov
Copy link
Contributor Author

Just want to emphasize how good the CLI interface is by the way:

@romac cool, thanks; glad you like it :) What I particularly like about gumdrop is that it's so transparent that I can reuse the same structs for the Rust API and for the CLI...

@andrey-kuprianov
Copy link
Contributor Author

@shonfeder @romac @brapse I think I've addressed all the issues raised in your reviews; thank you, that was very helpful, and allowed to improve the code a lot:)

shonfeder
shonfeder previously approved these changes Jul 22, 2020
brapse
brapse previously approved these changes Jul 22, 2020
Copy link
Contributor

@brapse brapse left a comment

Choose a reason for hiding this comment

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

👍

tendermint-testgen/Cargo.toml Outdated Show resolved Hide resolved
tendermint-testgen/src/header.rs Outdated Show resolved Hide resolved
Cargo.toml Outdated Show resolved Hide resolved
decided to make `round` an explicit parameter when constructing the
commit.

The reason for this is that we want to allow generating votes only from
the header, but without explicitely given round, the generated votes
will point to the default 1. Setting the `round` afterwards in the Commit
struct will have no effect on those votes.

That's why `round` is now an explicit parameter, and there are two constructors:
`new()`, and `new_with_votes()`.
@andrey-kuprianov
Copy link
Contributor Author

@brapse @romac I think I've addressed all the issues raised. For some reason Github says there are still pending changes suggested by @romac, but I don't see anything left, and don't know how to resolve this...

If everything is OK from your side, could you please merge the PR?

@andrey-kuprianov
Copy link
Contributor Author

Btw, the failing cargo fmt has nothing to do with this PR...

@romac romac changed the title tendermint-testgen Generator of Tendermint types for unit, integration, and model-based testing #393 Jul 29, 2020
@romac romac changed the title Generator of Tendermint types for unit, integration, and model-based testing #393 Generator of Tendermint types for unit, integration, and model-based testing Jul 29, 2020
@brapse brapse merged commit 877c586 into master Jul 29, 2020
@brapse brapse deleted the andrey/mbt-utils branch July 29, 2020 09:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants