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 crisis tests #4918

Merged
merged 5 commits into from
Aug 27, 2019
Merged

refactor crisis tests #4918

merged 5 commits into from
Aug 27, 2019

Conversation

colin-axner
Copy link
Contributor

#4875 has merge conflict with #4909

  • Targeted PR against correct branch (see CONTRIBUTING.md)

  • Linked to github-issue with discussion and accepted design OR link to spec that describes this work.

  • Wrote tests

  • Updated relevant documentation (docs/)

  • Added a relevant changelog entry to the Unreleased section in CHANGELOG.md

  • Re-reviewed Files changed in the github PR explorer


For Admin Use:

  • Added appropriate labels to PR (ex. wip, ready-for-review, docs)
  • Reviewers Assigned
  • Squashed all commits, uses message "Merge pull request #XYZ: [title]" (coding standards)

@codecov
Copy link

codecov bot commented Aug 16, 2019

Codecov Report

Merging #4918 into master will increase coverage by 0.06%.
The diff coverage is 0%.

@@            Coverage Diff             @@
##           master    #4918      +/-   ##
==========================================
+ Coverage   53.75%   53.81%   +0.06%     
==========================================
  Files         272      272              
  Lines       17103    17117      +14     
==========================================
+ Hits         9194     9212      +18     
+ Misses       7222     7218       -4     
  Partials      687      687

x/crisis/handler_test.go Outdated Show resolved Hide resolved
return app
}

func testPassingInvariant(_ sdk.Context) (string, bool) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

what are these for? they don't seem to provide any value other than its name

Copy link
Contributor Author

Choose a reason for hiding this comment

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

they are used in keeper_test.go. I believe it is just there for readability of a passing/failing invariant function

Copy link
Collaborator

Choose a reason for hiding this comment

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

can we delete them then? 🙏

Copy link
Contributor

@alexanderbez alexanderbez left a comment

Choose a reason for hiding this comment

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

One minor nit, otherwise LGTM 👍


initCoins := sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), accAmt))
totalSupply := sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), accAmt.MulRaw(int64(len(testAddrs)))))
app.SupplyKeeper.SetSupply(ctx, supply.NewSupply(totalSupply))
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you think think this should be done outside of the function call? Or maybe just added to the total supply instead of simply reseting it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, will add it to the total supply. It can be easy to forget to update supply when writing tests so I think keeping this functionality encapsulated in this helper function will prevent useless debugging

Copy link
Collaborator

@fedekunze fedekunze left a comment

Choose a reason for hiding this comment

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

ACK pending my prev comment.

Copy link
Contributor

@alexanderbez alexanderbez left a comment

Choose a reason for hiding this comment

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

ACK 🎉

@alexanderbez alexanderbez merged commit 5aacf45 into master Aug 27, 2019
@alexanderbez alexanderbez deleted the colin/4875-refactor-crisis-tests branch August 27, 2019 13:19
larry0x pushed a commit to larry0x/cosmos-sdk that referenced this pull request May 22, 2023
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.

3 participants