Skip to content
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

tests: add showcase tests for reading grpc/rest response metadata #2300

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

parthea
Copy link
Contributor

@parthea parthea commented Dec 17, 2024

This PR is built on top of #2299 and adds showcase test for grpc/rest response metadata

@product-auto-label product-auto-label bot added the size: m Pull request size is medium. label Dec 17, 2024
@parthea parthea force-pushed the add-showcase-test-rest-interceptors-metadata branch from 4d0f596 to a48fc54 Compare December 17, 2024 17:07
@parthea parthea marked this pull request as ready for review December 17, 2024 17:07
@parthea parthea requested a review from a team as a code owner December 17, 2024 17:07
self.request_metadata = []
self.response_metadata = []

async def _add_metadata(self, client_call_details):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
async def _add_metadata(self, client_call_details):
async def _add_request_metadata(self, client_call_details):

response_it = continuation(client_call_details, request)
return response_it

async def intercept_stream_unary(
Copy link
Contributor

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.

return response_it


class MetadataClienRestInterceptor(EchoRestInterceptor):
Copy link
Contributor

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

Suggested change
class MetadataClienRestInterceptor(EchoRestInterceptor):
class EchoMetadataClienRestInterceptor(EchoRestInterceptor):



@pytest.fixture
def intercepted_echo_grpc_async():
Copy link
Contributor

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?



@pytest.fixture
def intercepted_echo_rest():
Copy link
Contributor

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?

@@ -21,9 +21,10 @@
intercepted_metadata = (('showcase-trailer', 'intercepted'),)


def test_unary_stream(intercepted_echo):
def test_unary_stream(intercepted_echo_grpc):
Copy link
Contributor

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?



@pytest.mark.parametrize(
"transport,response_metadata",
Copy link
Contributor

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.

Base automatically changed from add-rest-response-metadata to main December 18, 2024 18:57
@parthea parthea assigned parthea and unassigned vchudnov-g Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: m Pull request size is medium.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants