-
Notifications
You must be signed in to change notification settings - Fork 586
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
test: add panic cases in tests for UpgradeOpen
#5550
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5550 +/- ##
==========================================
+ Coverage 81.61% 81.64% +0.02%
==========================================
Files 199 199
Lines 15146 15146
==========================================
+ Hits 12362 12366 +4
+ Misses 2319 2317 -2
+ Partials 465 463 -2 |
thanks! base branched targeted should now be main and not 04-channel-upgrades. Do you want to switch the branch over to that one? If you want, we could also help out with that (might get messy when the switch is done) |
c958b9e
to
3d3ebfc
Compare
Thank you @DimitrisJim. I think creating new branch from main and making the same changes at |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks! left some initial comments, overall looking good!
modules/apps/27-interchain-accounts/controller/ibc_middleware_test.go
Outdated
Show resolved
Hide resolved
modules/apps/27-interchain-accounts/controller/ibc_middleware_test.go
Outdated
Show resolved
Hide resolved
…/impl-panic-tests
…rio/ibc-go into neitdung/impl-panic-tests
…/impl-panic-tests
…rio/ibc-go into neitdung/impl-panic-tests
UpgradeOpen
WalkthroughThe recent update focuses on enhancing the test coverage for the Changes
Assessment against linked issues
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
"failure: upgrade route not found", | ||
func() {}, | ||
errorsmod.Wrap(porttypes.ErrInvalidRoute, "upgrade route not found to module in application callstack"), | ||
}, | ||
{ | ||
"failure: connection not found", | ||
func() { | ||
path.EndpointA.ChannelID = "invalid-channel" | ||
}, | ||
errorsmod.Wrapf(channeltypes.ErrChannelNotFound, "port ID (%s) channel ID (%s)", TestPortID, "invalid-channel"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test case "failure: connection not found" uses hardcoded values in the error message. Consider using dynamic values from the test setup to ensure the error message is accurate and maintainable if test parameters change.
- errorsmod.Wrapf(channeltypes.ErrChannelNotFound, "port ID (%s) channel ID (%s)", TestPortID, "invalid-channel"),
+ errorsmod.Wrapf(channeltypes.ErrChannelNotFound, "port ID (%s) channel ID (%s)", path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID),
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
"failure: upgrade route not found", | |
func() {}, | |
errorsmod.Wrap(porttypes.ErrInvalidRoute, "upgrade route not found to module in application callstack"), | |
}, | |
{ | |
"failure: connection not found", | |
func() { | |
path.EndpointA.ChannelID = "invalid-channel" | |
}, | |
errorsmod.Wrapf(channeltypes.ErrChannelNotFound, "port ID (%s) channel ID (%s)", TestPortID, "invalid-channel"), | |
"failure: upgrade route not found", | |
func() {}, | |
errorsmod.Wrap(porttypes.ErrInvalidRoute, "upgrade route not found to module in application callstack"), | |
}, | |
{ | |
"failure: connection not found", | |
func() { | |
path.EndpointA.ChannelID = "invalid-channel" | |
}, | |
errorsmod.Wrapf(channeltypes.ErrChannelNotFound, "port ID (%s) channel ID (%s)", path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry for the delay! This LGTM, thanks for working on it!
Description
OnChanUpgradeOpen
andOnChanUpgradeRestore
UpgradeableModule
interface from #5406closes: #5471
Commit Message / Changelog Entry
see the guidelines for commit messages. (view raw markdown for examples)
Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.
docs/
) or specification (x/<module>/spec/
).godoc
comments.Files changed
in the Github PR explorer.Codecov Report
in the comment section below once CI passes.Summary by CodeRabbit
cosmossdk.io/errors
.expPanic
field to test cases inTestOnChanUpgradeOpen
function.TestOnChanUpgradeOpen
to handle expected errors and panics based on test cases.