-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
x/auth: in-process test refactor #6573
x/auth: in-process test refactor #6573
Conversation
Codecov Report
@@ Coverage Diff @@
## master #6573 +/- ##
==========================================
+ Coverage 58.65% 59.19% +0.54%
==========================================
Files 512 512
Lines 31280 31295 +15
==========================================
+ Hits 18346 18525 +179
+ Misses 11546 11363 -183
- Partials 1388 1407 +19 |
…to jonathan/tx-builder
…s-integration-test
…s-integration-test
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.
…hub.com:cosmos/cosmos-sdk into jonathan/auth-module-inprocess-integration-test
Check now @alexanderbez , I kept the function unexported in every test, I did not dare to repeat by every function the logic that builds the context, do the mockIO etc. Because of DRY, but I can do it if still we agree that is verbose. |
x/auth/client/testutil/helpers.go
Outdated
return callCliCmd(clientCtx, cli.GetDecodeCommand, args) | ||
} | ||
|
||
func callCliCmd(clientCtx client.Context, theCmd func() *cobra.Command, extraArgs []string) ([]byte, error) { |
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 guess it is worth have an auxiliary function for this.
- Rename it:
ExecTestCLICmd
- Why does it take a command function, and not just a
*cobra.Command
literal? - Move this to the
testutils
pkg.
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.
Check now, I have put it back to the testutil but now there is lots of problems of import cycle, so I put it into testutil/cli. If we want to change that and make it work into testutil I will open an issue because everytime I get new problems with this PR when merging master.
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.
Looks great! I approve! Just left one minor remark.
testutil/cli/cmd.go
Outdated
) | ||
|
||
// ExecTestCLICmd builds the client context, mocks the output and executes the command. | ||
func ExecTestCLICmd(clientCtx client.Context, cmd *cobra.Command, extraArgs []string) ([]byte, error) { |
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.
Let's return out
here instead of []byte
. Otherwise, ACK 🎉
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.
Done!
* remove unused functions * create helper func to send tx * refactor to use test help to send tx by client * Commit before getting backend. * Temporal commit * temp commit * remove the creation of txbuilder from cli * fix imports * update changelog * Remove unused function. * Add flag home into tx sign command. * migrade TestCLIValidateSignatures to use new test suite * migrate test one * Add changes to make sign batch. * make test pass * refactor common logic * First part of cli sign. * Add test for sign batch. * refactor a little and improve the test * migrate broadcast command * fix linter * Remove printf for debug in bank module. * Fix unused err var. * fix linter * fix test * fix tests client * Fix linter. * Temp commit signature. * encode tx * migrate tests * Fix imports. * Remove changelog * fix tests * Fix tests. * Update x/bank/client/testutil/cli_helpers.go * Remove alias. * Remove wait for N block func. * export callCmd function into its own file. * fix imports * bring back to inner functions * apply mock io * the helpers use mockio * fix bug * Add Helpers. * return to put the function in testutil package * return BufferWriter in ExecTestCLICmd Co-authored-by: Alessio Treglia <alessio@tendermint.com> Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com> Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>
Description
ref: #6423
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.Unreleased
section inCHANGELOG.md
Files changed
in the Github PR explorerCodecov Report
in the comment section below once CI passes