-
Notifications
You must be signed in to change notification settings - Fork 513
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
services/horizon: Test full coverage of operation type switches #3560
services/horizon: Test full coverage of operation type switches #3560
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!
// make sure the check works for an unreasonable operation type | ||
_, err := UnmarshalOperation(200000, []byte{}) | ||
assert.Error(t, err) | ||
assert.Equal(t, mistmatchErr, err) |
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.
Nit, there's EqualError
that can be useful here.
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 know, thanks! However, the error is currently identical, so I think it's fine.
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.
Yeah, I mean, you can merge Error
and Equal
intro EqualError
but the current is fine obviously.
f09e5d4
to
255f360
Compare
255f360
to
c111c4e
Compare
c111c4e
to
04038a2
Compare
Part of #3430
I incorporated new tests, which use
xdr
'soperationTypeMap
(now exported asOperationTypeToStringMap
) to go over all possible operations, even when we incorporate new ones.The idea is that, from now on, every time we add a new XDR operation (i.e. through a CAP), the developer gets guided on what needs to be modified based on the failing tests.
The tests I added can be considered finicky, but it's hard to do it generically in a robust way.