-
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
feat: integration test helpers #15556
Conversation
Opening already, so possibly we can migrate module in follow-ups. |
:::note | ||
You can as well use the `AppConfig` `configurator` for creating an `AppConfig` [inline](https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/x/slashing/app_test.go#L54-L62). There no difference between those two ways, use whichever you prefer. | ||
::: | ||
Integration tests interact with the tested module via the defined `Msg` and `Query` services. The result of the test can be verified by checking the state of the application, by checking the emitted events or the response. It is adviced to combine two of these methods to verify the result of the 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.
will we document how to set things up here or elsewhere?
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.
Here, as they are for testing modules integrations.
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 wasn't able to read all the way through this before my end of day, but I did leave two comments. I can take another look tomorrow.
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 I follow what's going on here now. Structure and organization looks fine overall.
Let's change the test labeled example to an example test so it shows up at pkg.go.dev, and there were a few other small details I called out to help consumers follow intent here.
Thank you for the great feedback @mark-rushakoff! I've added your suggestions. |
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 didn't read the markdown changes closely, nor did I look closely at the changes in tests/integration/slashing/keeper/keeper_test.go. But the additions to testutil/integration look fine to me.
I noted a couple other small typos here, but otherwise I think this can be merged.
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.
nice work julien
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.
Good to see this work happening. Would be nice to align it with the direction core API is going. I think we also need ways to advance blocks so that begin and end blockers get called
return app.ctx | ||
} | ||
|
||
func (app *App) QueryHelper() *baseapp.QueryServiceTestHelper { |
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.
Why don't we just return grpc.ClientConnInterface?
Right, Marko mentioned that too. I'll open a PR about the last comment. About Core API I don't think we can update it here just yet. |
Description
Closes: #14676
I have not pushed everything yet: (#15556 (comment))
I am as well exploring a way to register the msg server and query server directly when creating a integration app.
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
!
to the type prefix if API or client breaking changeCHANGELOG.md
Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
I have...
!
in the type prefix if API or client breaking change