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

Osmocli: Fix lines of code overhead + speed of CLI tests #3647

Merged
merged 17 commits into from
Dec 12, 2022

Conversation

ValarDragon
Copy link
Member

@ValarDragon ValarDragon commented Dec 7, 2022

Cref: #3641

What is the purpose of the change

Makes writing CLI tests very fast, and few lines of code, testing exactly what you want to test

Txs currently done and queries done. Propogated to most of the CLI.

  • I migrated everything in incentives, except the test for CmdRewardsEst, which if you investigate didn't actually test anything.
  • Migrated everything in gamm. Removed a few of the 0 argument queries, since not really anything meaningful to test
  • Deleted tests in pool-incentives, because they were never ran before.

Net go test time down from 4minutes to 3minutes 30 seconds. (I am confused though, because if you add up the time thats no longer in CLI tests from gamm, incentives, lockup, thats 76 seconds. So perhaps theres some degree of parallelism in tests somewhere? But also confusingly, sum of the remaining module test times appear to me to be roughly around 2 minutes, not sure how its still saying its 3.5 minutes. My guess would be theres something with it not counting time executed from cgo/cosmwasm contracts?)

Brief Changelog

  • Makes CLI tests effective and succinct

Testing and Verifying

This change adds tests for all CLI commands it changes, that can be easily verified!
Note, I do also delete a few of the old cli_tests in lockup. We tested parsing of a larger subset of the messages before, but due to the standardization now applied, I only wrote one test per "class" of message we parse.

Documentation and Release Note

  • Does this pull request introduce a new feature or user-facing behavior changes? no
  • Is a relevant changelog entry added to the Unreleased section in CHANGELOG.md? yes
  • How is the feature or change documented? N/A for now, perhaps we should add some docs in Readme as later step in epic

@ValarDragon ValarDragon changed the title Osmocli: Fix CLI tests Osmocli: Fix lines of code overhead + speed of CLI tests Dec 7, 2022
@github-actions github-actions bot added the C:x/gamm Changes, features and bugs related to the gamm module. label Dec 7, 2022
Base automatically changed from dev/osmocli_custom_parser to main December 7, 2022 23:02
@ValarDragon ValarDragon added V:state/compatible/backport State machine compatible PR, should be backported A:backport/v13.x backport patches to v13.x branch labels Dec 7, 2022
@pysel
Copy link
Member

pysel commented Dec 9, 2022

👍

@pysel
Copy link
Member

pysel commented Dec 9, 2022

Here are PRs related to this PR:
mint module tests migration: #3662
epochs module tests migration: #3661

@ValarDragon ValarDragon mentioned this pull request Dec 11, 2022
6 tasks
@ValarDragon
Copy link
Member Author

Per call, were good with merging this, as its just CLI affecting. (And unblocks other things)

@ValarDragon ValarDragon merged commit 1986ad2 into main Dec 12, 2022
@ValarDragon ValarDragon deleted the dev/osmocli_test_fix branch December 12, 2022 17:55
mergify bot pushed a commit that referenced this pull request Dec 12, 2022
* Initial commit for cli test fixing

* Finish replacing tx tests

* Start query modification for testability

* Testing scaffolding now in place

* sync

* Fix cobra not resetting flag values

* Delete more cli tests

* Migrate incentives modules tests

* WIP on gamm deletion

* Finish converting all gamm tx tests

* Cleanup gamm index command

* pflag -> flag (alias, not import)

* Delete tests for 0-arg fns

* Convert simple query tests

* Finish adapting gamm tests

* Changelog

* Delete test suite that was never being ran

(cherry picked from commit 1986ad2)

# Conflicts:
#	osmoutils/cli_helpers.go
ValarDragon added a commit that referenced this pull request Dec 13, 2022
) (#3694)

* Osmocli: Fix lines of code overhead + speed of CLI tests (#3647)

* Initial commit for cli test fixing

* Finish replacing tx tests

* Start query modification for testability

* Testing scaffolding now in place

* sync

* Fix cobra not resetting flag values

* Delete more cli tests

* Migrate incentives modules tests

* WIP on gamm deletion

* Finish converting all gamm tx tests

* Cleanup gamm index command

* pflag -> flag (alias, not import)

* Delete tests for 0-arg fns

* Convert simple query tests

* Finish adapting gamm tests

* Changelog

* Delete test suite that was never being ran

(cherry picked from commit 1986ad2)

# Conflicts:
#	osmoutils/cli_helpers.go

* Fix conflict

Co-authored-by: Dev Ojha <ValarDragon@users.noreply.github.com>
Co-authored-by: Dev Ojha <dojha@berkeley.edu>
@github-actions github-actions bot mentioned this pull request May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A:backport/v13.x backport patches to v13.x branch C:CLI C:x/gamm Changes, features and bugs related to the gamm module. C:x/incentives C:x/lockup C:x/pool-incentives V:state/compatible/backport State machine compatible PR, should be backported
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants