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

refactor: use mocks for x/distribution #12889

Merged
merged 33 commits into from
Aug 29, 2022
Merged

refactor: use mocks for x/distribution #12889

merged 33 commits into from
Aug 29, 2022

Conversation

facundomedica
Copy link
Member

@facundomedica facundomedica commented Aug 10, 2022

Description

Use mocks and move integration tests to the right directory.

Closes: #12758


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 in the PR title
  • added ! to the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • followed the guidelines for building modules
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • 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 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)

@github-actions github-actions bot added C:x/distribution distribution module related Type: Build labels Aug 10, 2022
@codecov
Copy link

codecov bot commented Aug 12, 2022

Codecov Report

Merging #12889 (0a84870) into main (4fe7797) will decrease coverage by 2.64%.
The diff coverage is 57.46%.

❗ Current head 0a84870 differs from pull request most recent head de4eee6. Consider uploading reports for the commit de4eee6 to get more accurate results

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #12889      +/-   ##
==========================================
- Coverage   55.87%   53.23%   -2.65%     
==========================================
  Files         646      643       -3     
  Lines       54895    54859      -36     
==========================================
- Hits        30675    29204    -1471     
- Misses      21762    23333    +1571     
+ Partials     2458     2322     -136     
Impacted Files Coverage Δ
baseapp/abci.go 64.09% <0.00%> (-0.33%) ⬇️
client/flags/flags.go 19.35% <0.00%> (-0.32%) ⬇️
client/rpc/status.go 66.66% <ø> (ø)
client/utils.go 34.92% <0.00%> (ø)
server/config/config.go 38.00% <0.00%> (-1.59%) ⬇️
server/rosetta/client_online.go 1.35% <0.00%> (ø)
server/swagger.go 0.00% <0.00%> (ø)
testutil/list.go 0.00% <0.00%> (ø)
types/result.go 76.74% <ø> (ø)
x/auth/tx/query.go 0.00% <ø> (ø)
... and 94 more

x/distribution/abci.go Fixed Show fixed Hide fixed
x/distribution/abci.go Fixed Show fixed Hide fixed
@facundomedica facundomedica marked this pull request as ready for review August 19, 2022 18:30
@facundomedica facundomedica requested a review from a team as a code owner August 19, 2022 18:30
Copy link
Member

@julienrbrt julienrbrt left a comment

Choose a reason for hiding this comment

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

lgtm, just curious why simulation tests are moving tests/integration, it does not use simapp.

@facundomedica
Copy link
Member Author

lgtm, just curious why simulation tests are moving tests/integration, it does not use simapp.

We use simtestutil.Setup( which I understand should be an integration test by the ADR (https://github.com/cosmos/cosmos-sdk/blob/main/docs/architecture/adr-059-test-scopes.md#decision). Lmk if you think otherwise, I'm gonna fix the conflicts now and if we need to move those tests back I can do so :)

@facundomedica
Copy link
Member Author

I suppose I need to run make rosetta-data to solve the missing test but I'm getting panic: could not create directory "data": mkdir data: no such file or directory

@facundomedica facundomedica merged commit 0024a0b into main Aug 29, 2022
@facundomedica facundomedica deleted the facu/distr-mocks branch August 29, 2022 23:15
Wryhder pushed a commit to Wryhder/cosmos-sdk that referenced this pull request Oct 26, 2022
* initial commit

* add mocks

* TestAllocateTokensToManyValidators

* one file more in, like a hundred left

* progress

* progress

* move tests to integration

* finally got TestCalculateRewardsMultiDelegator right lol

* small fixes

* progress

* progress

* progress

* progress

* revert test panic

* progress

* progress

* more progress

* fix go.mod

* merge

* merge

* cache issue?

* fix go.sum

* fix tests

* make mocks

* move back simulations

Co-authored-by: Marko <marbar3778@yahoo.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

rewrite x/distribution tests to use mocks
5 participants