Cosmos-sdk: Increase coverage on IBC module

Created on 3 Jan 2020  Â·  3Comments  Â·  Source: cosmos/cosmos-sdk

Summary

Some message validation conditions and types are not tested on the IBC implementation.

Proposal

  • Increase code coverage on the /types package within the x/ibc module
  • Standardize the unit tests to be table-driven or use the testing suite (only in the case of the keepers and when the test use common types).

TODO add tests:

  • [ ] x/ibc/04-channel/keeper/packet.go
  • [ ] x/ibc/04-channel/keeper/timeout.go

For Admin Use

  • [ ] Not duplicate issue
  • [ ] Appropriate labels applied
  • [ ] Appropriate contributors tagged
  • [ ] Contributor assigned/self-assigned
good first issue help wanted tests ibc

All 3 comments

As we discussed I can work on it. So I guess I have to work against the ibc-alpha branch. I found a types package inside, but it has only few lines of code, so I think I have to write test for the sub-packages what number prefixed.

@fedekunze I don't see how but the errors.Is() doesn't work properly in case of sdkerrors.Wrap().
So I called for MsgCreateClient#ValidateBasic with the ClientType = "bad_type". It returns an error to me: invalid client type: bad_type.
The line compose this error is: return sdkerrors.Wrap(errors.ErrInvalidClientType, msg.ClientType)

In the test case I want to test for errors.Is(err, errs.ErrInvalidClientType) (I renamed that to have the built-in error package) but I get false for that. In other error returns where it doesn't have the sdkerrors.Wrap(), I can use the errors.Is() case properly.

Is that an issue, or I just missed something?

@PumpkinSeed can you open an issue? I personally haven’t used that function in a while. We can look into it tomorrow

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rigelrozanski picture rigelrozanski  Â·  3Comments

rigelrozanski picture rigelrozanski  Â·  3Comments

fedekunze picture fedekunze  Â·  3Comments

cwgoes picture cwgoes  Â·  3Comments

mossid picture mossid  Â·  3Comments