Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

token-cli: Add tests for all cases from docs #3070

Merged
merged 4 commits into from
Apr 15, 2022

Conversation

joncinque
Copy link
Contributor

Problem

The token CLI has no tests, making it hard to see if token-2022 will also be supported from the CLI.

Solution

Refactor the CLI to be testable, and add tests inspired by the docs.

Note: due to the build issue on solana-test-validator with the yanked lru crate, this depends on the upgrade to 1.10.7. Once the upgrade is pushed, this can use TestValidator everywhere. Currently, in my own testing environment, I have it run against a test validator.

@joncinque joncinque marked this pull request as ready for review April 13, 2022 13:29
Copy link
Contributor

@CriesofCarrots CriesofCarrots left a comment

Choose a reason for hiding this comment

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

Maybe I missed something, but these don't actually get run in CI, do they?
Refactor and tests look good, though!

mut bulk_signers: Vec<Box<dyn Signer>>,
) -> CommandResult {
match (sub_command, sub_matches) {
("bench", arg_matches) => bench_process_command(
Copy link
Contributor

Choose a reason for hiding this comment

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

I spent too long trying to figure out why this went from Some(arg_matches) to arg_matches... wow, our handling of matches/arg_matches/sub_matches was dumb. Thanks for cleaning it up!

@joncinque
Copy link
Contributor Author

Maybe I missed something, but these don't actually get run in CI, do they?

They get run as part of cargo-build-test. You can see the run starting at https://github.com/solana-labs/solana-program-library/runs/6007493531?check_suite_focus=true#step:9:1767 -- is that ok?

@CriesofCarrots
Copy link
Contributor

Aha, yep, did miss it. I think the log didn't expand fully when I was searching for test names. Thanks!

@joncinque joncinque merged commit bbde6d8 into solana-labs:master Apr 15, 2022
@joncinque joncinque deleted the tkcli-t branch April 15, 2022 19:51
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants