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

chore: check all errors in tests #5104

Merged
merged 20 commits into from
May 9, 2023
Merged

chore: check all errors in tests #5104

merged 20 commits into from
May 9, 2023

Conversation

faddat
Copy link
Member

@faddat faddat commented May 7, 2023

Closes: #5060

What is the purpose of the change

This PR is designed to enhance the rigor of tests in Osmosis by checking errors whenever possible.

It also extends the changes found in:

Note that the t.Helper() thing can be a bit all or nothing, so this PR contains those changes as well. If you'd prefer to close that one, no worries :).

By applying thelper to the whole repository. This is a part of an initiative to allow Osmosis to use golangci-lint on its tests, by setting

run:
  tests: true
  timeout: 10m

and then progressively adding additional tools like thelper. Note to vscode users: now that we're using t.Helper() at the beginning of every test helper, you'll get these really cool inline stack traces if there's an issue with a test.

Since we want golangci-lint to pass, this PR does not yet make the change to the configuration mentioned above, but it is what was used while writing the PR.

Brief Changelog

  • check as many errors as possible
  • minor linting on tests, only as a part of the error work

Testing and Verifying

This change is tests, and I suppose that the best way to test it is to maybe break some tests and check out the cool stack trace? I am actually not certain, but would love to hear ideas.

Reviewing

I'd recommend reviewing

before this one, it will reduce the size of this. To make sure that this merges smoothly, I cherry picked that into this.

There are about 200-300 miscellaneous linter changes that Id need to make for us to be able to enable the linter on the tests. I'm going to open one or more additional smaller PR's for that since I know this one is already pretty big.

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? not applicable

@github-actions github-actions bot added the C:simulator Edits simulator or simulations label May 7, 2023
@faddat faddat added the V:state/compatible/no_backport State machine compatible PR, depends on prior breaks label May 7, 2023
@faddat faddat marked this pull request as ready for review May 7, 2023 05:25
Copy link
Member

@czarcas7ic czarcas7ic left a comment

Choose a reason for hiding this comment

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

Approving, but going to wait for one more internal ack before merging. Thanks!

x/concentrated-liquidity/position_test.go Outdated Show resolved Hide resolved
Copy link
Member

@p0mvn p0mvn left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for this 🧹

.golangci.yml Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
x/concentrated-liquidity/export_test.go Outdated Show resolved Hide resolved
@p0mvn
Copy link
Member

p0mvn commented May 9, 2023

Ready to merge once few nits are addressed and PR is refreshed against main

@faddat
Copy link
Member Author

faddat commented May 9, 2023

Cool, refreshing now :)

@p0mvn p0mvn merged commit 86f9c1e into main May 9, 2023
@p0mvn p0mvn deleted the faddat/check-all-errors branch May 9, 2023 12:52
pysel pushed a commit that referenced this pull request Jun 6, 2023
* run golangci-lint and resolve ineffectual assignment to err

* go work sync

* waypoint in "check all errors in tests"

* 50 error checks remaining

* 42 errors remaining to check in tests

* all tests pass and as many errors as possible have been checked

* revert enabling golangci-lint to check tests, as it would always fail afterwards

* update changelog

* use thelper in golangci-lint without linting every test

* Update tests/e2e/containers/containers.go

Co-authored-by: Roman <[email protected]>

* thelper for incentives bench test

* Update x/concentrated-liquidity/position_test.go

Co-authored-by: Adam Tucker <[email protected]>

* Update CHANGELOG.md

Co-authored-by: Roman <[email protected]>

* return error in SetIncentiveRecord

* revert change to .golanci.yml

---------

Co-authored-by: Roman <[email protected]>
Co-authored-by: Adam Tucker <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C:app-wiring Changes to the app folder C:CLI C:simulator Edits simulator or simulations C:x/concentrated-liquidity C:x/gamm Changes, features and bugs related to the gamm module. C:x/incentives C:x/lockup C:x/mint C:x/pool-incentives C:x/poolmanager C:x/superfluid C:x/tokenfactory C:x/twap Changes to the twap module C:x/txfees T:CI V:state/compatible/no_backport State machine compatible PR, depends on prior breaks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

check all errors
3 participants