-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
EPIC: Unit Testing of Modules via Mocks #12398
Comments
When mocking modules, please always re-enable the disabled tests that required of gov to app wiring (They won't be re-enabled in #12274). See #12274 (comment) |
## Description Ref: #12398 --- ### Author Checklist *All items are required. Please add a note to the item if the item is not applicable and please add links to any relevant follow up issues.* I have... - [ ] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] added `!` to the type prefix if API or client breaking change - [ ] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/main/CONTRIBUTING.md#pr-targeting)) - [ ] provided a link to the relevant issue or specification - [ ] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/main/docs/building-modules) - [ ] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/main/CONTRIBUTING.md#testing) - [ ] added a changelog entry to `CHANGELOG.md` - [ ] included comments for [documenting Go code](https://blog.golang.org/godoc) - [ ] updated the relevant documentation or specification - [ ] reviewed "Files changed" and left comments if necessary - [ ] confirmed all CI checks have passed ### Reviewers Checklist *All items are required. Please add a note if the item is not applicable and please add your handle next to the items reviewed if you only reviewed selected items.* I have... - [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] confirmed `!` in the type prefix if API or client breaking change - [ ] confirmed all author checklist items have been addressed - [ ] reviewed state machine logic - [ ] reviewed API design and naming - [ ] reviewed documentation is accurate - [ ] reviewed tests and test coverage - [ ] manually tested (if applicable)
## Description Ref: #12398 --- ### Author Checklist *All items are required. Please add a note to the item if the item is not applicable and please add links to any relevant follow up issues.* I have... - [x] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [x] added `!` to the type prefix if API or client breaking change - [x] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/main/CONTRIBUTING.md#pr-targeting)) - [x] provided a link to the relevant issue or specification - [ ] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/main/docs/building-modules) - [ ] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/main/CONTRIBUTING.md#testing) - [ ] added a changelog entry to `CHANGELOG.md` - [ ] included comments for [documenting Go code](https://blog.golang.org/godoc) - [ ] updated the relevant documentation or specification - [ ] reviewed "Files changed" and left comments if necessary - [ ] confirmed all CI checks have passed ### Reviewers Checklist *All items are required. Please add a note if the item is not applicable and please add your handle next to the items reviewed if you only reviewed selected items.* I have... - [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] confirmed `!` in the type prefix if API or client breaking change - [ ] confirmed all author checklist items have been addressed - [ ] reviewed state machine logic - [ ] reviewed API design and naming - [ ] reviewed documentation is accurate - [ ] reviewed tests and test coverage - [ ] manually tested (if applicable)
part of this issue should also be removing the build flag for testing with the race detector. There is still a larger open todo of mocking tendermint. @aaronc mentioned having something already, could we reuse this? |
In the last team call we discussed moving the current integration tests into simapp to not lose them but still decouple simapp from the repo. The current tests, cli tests, that rely on testutil/network would be rewritten to be cli unit tests of the cli interface. This will allow modules to not depend on each other for testing as well. We will plan on doing more in-depth integration tests as well |
Summary
Currently we have two main ways to test modules, the first are unit tests and the second are integration tests. The integration tests are closer to e2e tests because we do spin up tendermint validators in process. These integration tests rely on simapp and with the app wiring work rely on other modules. We should rewrite integration tests that can be written as unit tests as unit tests with mocks. The integration/e2e tests that test various things like cross module communication may need to be moved to the simapp level.
This has been a long standing problem with how we do test-race and test in ci. By rewriting to use mocks and away from integration tests in modules we should be able to remove tat-race ci jobs and the new coupling of modules introduced by app wiring.
Problem Definition
Current integration tests are closer to e2e tests and are testing things that can be tested in unit tests with mocks.
Proposal
TODOs
x/nft
(refactor: Use mocks for x/nft testing #12407)x/params
(refactor(x/params): use mocks for testing #12473)x/group
tests to use mocks #12763x/authz/
tests to use mocks #12761x/feegrant
(refactor: Use mocks for x/feegrant testing #12472)x/bank
(refactor: add mock unit tests for bank module #12721)tests/integration
refactor: x/bank integration and e2e tests #12779x/staking
to decouplesimapp
#13099x/slashing
tests to use mocks #12748x/distribution
tests to use mocks #12758x/mint
(refactor: Use mocks for x/mint testing #12468)x/gentutil
integration tests to use mocks #12759x/gov
Refactorx/gov
to use mocks #12752For Admin Use
The text was updated successfully, but these errors were encountered: