-
Notifications
You must be signed in to change notification settings - Fork 586
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
Add testing for client events #5686
Conversation
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.
Awesome! 😎
Thanks for picking these events tests up! Much appreciated
rebased to see if CI would all go green! 🍏
testing/events.go
Outdated
// containsAttribute returns true if the given key/value pair is contained in the given attributes. | ||
// NOTE: this ignores the indexed field, which can be set or unset depending on how the events are retrieved. | ||
func containsAttribute(attrs []abci.EventAttribute, key, value string) bool { | ||
for _, attr := range attrs { |
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.
a slices.ContainsFn() can be used on these?
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 suggestion we can use
return slices.ContainsFunc(attrs, func(attr abci.EventAttribute) bool {
return attr.Key == key && attr.Value == value
})
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, thanks for picking these up!
suite.SetupTest() | ||
path := ibctesting.NewPath(suite.chainA, suite.chainB) | ||
|
||
path.EndpointA.Counterparty.Chain.NextBlock() |
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.
this line might not be necessary anymore
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 like the test fails without this.
Description
Merge after #5682
Ref #2823
I had to do some refactoring of the
AssertEvents
function. The changes ensure that it is possible to pass eitherres.Events
orctx.EventManager().Events().ToABCIEvents()
as expected events.I opted to add some event testing into existing tests as they have quite an elaborate set up, and it decided it would be cleaner to just add additional assertions into those tests.
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.