-
Notifications
You must be signed in to change notification settings - Fork 77
tests: add showcase tests for reading grpc/rest response metadata #2300
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
Conversation
4d0f596 to
a48fc54
Compare
tests/system/conftest.py
Outdated
| self.request_metadata = [] | ||
| self.response_metadata = [] | ||
|
|
||
| async def _add_metadata(self, client_call_details): |
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.
| async def _add_metadata(self, client_call_details): | |
| async def _add_request_metadata(self, client_call_details): |
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.
fixed in e302dc7
| response_it = continuation(client_call_details, request) | ||
| return response_it | ||
|
|
||
| async def intercept_stream_unary( |
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.
We should use more descriptive names to differentiate this method from the previous one. I realize previously existing classes established this pattern, but we should clarify.
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 is not something that we can change as it's an abstract method in gRPC that we're overriding
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.
Ack. Too bad.
tests/system/conftest.py
Outdated
| return response_it | ||
|
|
||
|
|
||
| class MetadataClienRestInterceptor(EchoRestInterceptor): |
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 would clarify in the name that this is for the echo service
| class MetadataClienRestInterceptor(EchoRestInterceptor): | |
| class EchoMetadataClienRestInterceptor(EchoRestInterceptor): |
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.
Fixed in 1ae8aaa
tests/system/conftest.py
Outdated
|
|
||
|
|
||
| @pytest.fixture | ||
| def intercepted_echo_grpc_async(): |
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.
Put the two grpc fixtures next to each other?
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.
Fixed in 7147a58
|
|
||
|
|
||
| @pytest.fixture | ||
| def intercepted_echo_rest(): |
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.
We're waiting for REST async or can we test that now?
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.
Fixed in 05f6c65
|
|
||
|
|
||
| def test_unary_stream(intercepted_echo): | ||
| def test_unary_stream(intercepted_echo_grpc): |
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.
Do we want to test async grpc 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.
Fixed in 05f6c65
|
|
||
|
|
||
| @pytest.mark.parametrize( | ||
| "transport,response_metadata", |
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.
How do the interceptors used int his file know about the response metadata they should be injecting? Or is this real response metadata from Showcase? I'm not finding it by doing a search n the Showcase repo.
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 interceptors aren't injecting anything here. There is a feature of the echo rpc which adds response headers(metadata) with the X-Showcase-Request prefix automatically for REST , using information from the request. This was added in googleapis/gapic-showcase#1509. For gRPC, I believe this feature was added in googleapis/gapic-showcase#970
vchudnov-g
left a comment
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.
One q.
| response_it = continuation(client_call_details, request) | ||
| return response_it | ||
|
|
||
| async def intercept_stream_unary( |
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.
Ack. Too bad.
tests/system/conftest.py
Outdated
| @pytest.fixture | ||
| def intercepted_echo_grpc_async(): | ||
| # The interceptor adds 'showcase-trailer' client metadata. Showcase server | ||
| # echos any metadata with key 'showcase-trailer', so the same metadata |
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: sp. Above as well
| # echos any metadata with key 'showcase-trailer', so the same metadata | |
| # echoes any metadata with key 'showcase-trailer', so the same metadata |
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.
Fixed in 6495273
This PR adds showcase integration tests for reading response metadata using the following matrix: [(
gRPC,REST), (sync,async)]This PR depends on #2370.