-
Notifications
You must be signed in to change notification settings - Fork 619
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
Check for error returned in channel msg_tests #5492
Check for error returned in channel msg_tests #5492
Conversation
@DimitrisJim Can you take a brief look, is this okay so that I can continue for others Msgs ? |
@expertdicer thanks! I've pushed a change for the first validate test func as a small template. We can drop the |
…nfirmValidateBasic
…dateBasic, TestMsgChannelUpgradeInitValidateBasic, TestMsgChannelUpgradeTryValidateBasic
…nfirmValidateBasic
…deTimeoutValidateBasic
Or should we implement the error check like in: ibc-go/modules/core/04-channel/types/msgs_test.go Line 1252 in 947b15e
|
We should also see what others think on this. In my view, we should be checking the error message that is going to be presented even if this does lead to more verbose set-ups (wrapping the error and formatting in values). Can leave it as is for now we'll soon get some other opinions. At some point I'll open a bigger issue to ideally get all tests checking for the same thing. |
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.
i personally prefer error code checking as we wouldn't have to change tests if the error string gets rewritten. However, i think this PR can be merged as-is and we standardize on best practices internally.
Thanks @expertdicer !!
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.
I think it does add value to check the error message when the same error type is returned in multiple cases, but my only concern is the additional maintenance overhead (debugging and refactoring tests as error messages change).
I think I am actually happy just checking for the error type in most cases.
In the case of state machine breaking error messages changing it's definitely worth while, but for validate basic error messages maybe not so much.
yea, that was what my thinking was. I do recal seeing these in ValidateBasic tests but could be mistaken. Either way, it def makes more sense to only do in those cases. 👍 |
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.
Amazing! Thank you for adding all the errors in the tests!
* update test for MsgChannelOpenInit * update test for MsgChannelOpenTry * Use error as expError. * update TestMsgChannelOpenAckValidateBasic * update TestMsgChannelOpenConfirmValidateBasic * update TestMsgChannelCloseInitValidateBasic and TestMsgChannelCloseConfirmValidateBasic * update TestMsgRecvPacketValidateBasic * update TestMsgTimeoutValidateBasic * update TestMsgTimeoutOnCloseValidateBasic, TestMsgAcknowledgementValidateBasic, TestMsgChannelUpgradeInitValidateBasic, TestMsgChannelUpgradeTryValidateBasic * update TestMsgChannelUpgradeAckValidateBasic, TestMsgChannelUpgradeConfirmValidateBasic * update TestMsgChannelUpgradeOpenValidateBasic and TestMsgChannelUpgradeTimeoutValidateBasic * update TestMsgChannelUpgradeCancelValidateBasic * review comment * reorder test cases * remove unnecessary expPass variables --------- Co-authored-by: DimitrisJim <d.f.hilliard@gmail.com> Co-authored-by: Carlos Rodriguez <carlos@interchain.io> (cherry picked from commit f51d062) # Conflicts: # modules/core/04-channel/types/msgs_test.go
* Check for error returned in channel msg_tests (#5492) * update test for MsgChannelOpenInit * update test for MsgChannelOpenTry * Use error as expError. * update TestMsgChannelOpenAckValidateBasic * update TestMsgChannelOpenConfirmValidateBasic * update TestMsgChannelCloseInitValidateBasic and TestMsgChannelCloseConfirmValidateBasic * update TestMsgRecvPacketValidateBasic * update TestMsgTimeoutValidateBasic * update TestMsgTimeoutOnCloseValidateBasic, TestMsgAcknowledgementValidateBasic, TestMsgChannelUpgradeInitValidateBasic, TestMsgChannelUpgradeTryValidateBasic * update TestMsgChannelUpgradeAckValidateBasic, TestMsgChannelUpgradeConfirmValidateBasic * update TestMsgChannelUpgradeOpenValidateBasic and TestMsgChannelUpgradeTimeoutValidateBasic * update TestMsgChannelUpgradeCancelValidateBasic * review comment * reorder test cases * remove unnecessary expPass variables --------- Co-authored-by: DimitrisJim <d.f.hilliard@gmail.com> Co-authored-by: Carlos Rodriguez <carlos@interchain.io> (cherry picked from commit f51d062) # Conflicts: # modules/core/04-channel/types/msgs_test.go * merge artifacts --------- Co-authored-by: Lặc <67097720+expertdicer@users.noreply.github.com> Co-authored-by: Charly <charly@interchain.berlin>
Description
closes: #4304
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.