-
Notifications
You must be signed in to change notification settings - Fork 10
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
fix(grpc): the unary server interceptor was already set and may not be reset #419
Conversation
There can be only one interceptor set by `grpc.[With](Unary|Stream)Interceptor`, and a runtime error occurs if an interceptor is already defined and a second is attempted using the same API. Switch to using the chaining API, which appends to the existing list, and co-operates cleanly with the non-chained interceptor API. Also, adjust the gRPC test to verify adequate behavior occurs. Fixes #416
assert.True(t, interceptedDirect.Load(), "original interceptor was not called") | ||
assert.True(t, interceptedChain.Load(), "original chained interceptor was not called") |
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.
@RomainMuller Are the messages correct? If intercepted*
are true
, doesn't it mean they were called? The same for the same messages below.
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.
The message is for when it fails... But I'm a litle ambivalent as to whether they should mention what should've happened or what was observed that is a failure
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.
Oh, you are right! I usually go with something like original interceptor expected a call, it didn't happen
. Anyway, it's fine as long as it's understandable in the testing logs' context.
assert.True(t, interceptedDirect.Load(), "original interceptor was not called") | ||
assert.True(t, interceptedChain.Load(), "original chained interceptor was not called") |
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.
Oh, you are right! I usually go with something like original interceptor expected a call, it didn't happen
. Anyway, it's fine as long as it's understandable in the testing logs' context.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #419 +/- ##
==========================================
+ Coverage 63.97% 64.67% +0.70%
==========================================
Files 180 180
Lines 10894 10924 +30
==========================================
+ Hits 6969 7065 +96
+ Misses 3401 3314 -87
- Partials 524 545 +21
|
There can be only one interceptor set by
grpc.[With](Unary|Stream)Interceptor
, and a runtime error occurs if an interceptor is already defined and a second is attempted using the same API. Switch to using the chaining API, which appends to the existing list, and co-operates cleanly with the non-chained interceptor API.Also, adjust the gRPC test to verify adequate behavior occurs.
Fixes #416