-
Notifications
You must be signed in to change notification settings - Fork 801
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
Improves metric and error handling for history #5469
Improves metric and error handling for history #5469
Conversation
h := handlerImpl{ | ||
Resource: resource.NewTest(gomock.NewController(t), 0), | ||
} | ||
h.error(td.input, &scope, "some-domain", "some-wf", "some-run") |
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 am not familiar with this mock library. where is the validation happening? AFAICT td.expectation
is marking some method calls with once but when is it ensured those calls happened exactly once and no other calls?
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 don't love the mocking library either, I'd like to get rid of it in favour of our normal gomock one, but it's what's already here, so I didn't try and change it.
--- FAIL: TestCorrectUseOfErrorHandling/uncategorized_error (0.00s)
panic:
assert: mock: I don't know what to return because the method call was unexpected.
Either do Mock.On("IncCounter").Return(...) first, or remove the IncCounter() call.
This method was unexpected:
IncCounter(int)
0: 1
panic:
assert: mock: I don't know what to return because the method call was unexpected.
Either do Mock.On("IncCounter").Return(...) first, or remove the IncCounter() call.
This method was unexpected:
IncCounter(int)
0: 1
You're right there's nothing ensuring there's a counter call, let me add an assertion on that.
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.
Added scope.Mock.AssertCalled
below to ensure that completely ommiting a call to counter is not missed
This was originally added (and not working) with #5438 and this followup corrects it and adds some actual metrics tests to ensure such a miss doesn't happen again.
The driver of this change, to reiterate was two things: