regen-ledger
regen-ledger copied to clipboard
Unit tests for gRPC endpoints and CLI commands
Summary
We are currently using the integration test suite for gRPC endpoints and CLI commands. This is redundant if we are also writing integration tests for the server implementation. This has also proven difficult to maintain and introduces nuances when checking the length of returned items from queries. Integration tests might not be the best route for gRPC and CLI commands but rather used only with the server implementation methods.
Problem Definition
The current client integration tests are redundant of the integration tests for the server implementation. How to write integration tests is not clear and the client integration tests are difficult to maintain and do not allow us to properly check the length of returned values.
Proposal
Update the client integration tests to unit tests, removing the use of the integration test suite.
For Admin Use
- [ ] Not duplicate issue
- [ ] Appropriate labels applied
- [ ] Appropriate contributors tagged
- [ ] Contributor assigned/self-assigned
I agree integration tests should mostly be focused on the server level using MsgClient
/MsgServer
directly - basically the level just above unit tests rather than all the way out to CLI.
I guess we could unit test CLI/gRPC with mocks?
I would note that one of my goals in the Cosmos SDK this year is to deprecate manually written CLI and gRPC query methods. Ideally all of that would be auto-generated by reflection on Msg
s and ORM definitions in the .proto fiels.
Also relevant to https://github.com/cosmos/cosmos-sdk/issues/12696