Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: resolve issue handling protobuf responses in rest streaming#604

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
parthea merged 5 commits intomainfromfix-rest-streaming
Feb 13, 2024

Conversation

@parthea
Copy link
Collaborator

Towards b/311671723

@product-auto-labelproduct-auto-labelbot added the size: mPull request size is medium. labelFeb 12, 2024
@partheaparthea marked this pull request as ready for reviewFebruary 12, 2024 21:01
@partheaparthea requested review froma team ascode ownersFebruary 12, 2024 21:01
Copy link
Contributor

@vchudnov-gvchudnov-g left a comment

Choose a reason for hiding this comment

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

A few minor comments, but LGTM.

returnself._response_message_cls.from_json(self._ready_objs.popleft())
ifissubclass(self._response_message_cls,proto.Message):
returnself._response_message_cls.from_json(self._ready_objs.popleft())
else:
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: for safety and future-proofing, maybe this should be anelif and we check forgoogle.protobuf.Message
(I realize we don't expect to ever have the second check fail if we get here....but "we don't expect" == "famous last words")

(not a blocker)

parthea reacted with thumbs up emoji
Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

Fixed in9f5b22f

responses= [EchoResponse(content="hello world"),EchoResponse(content="yes")]
@pytest.mark.parametrize(
"random_split,resp_message_is_proto_plus,response_type",
[(False,True,EchoResponse), (False,False,httpbody_pb2.HttpBody)],
Copy link
Contributor

Choose a reason for hiding this comment

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

Given that you're not testing different combinations ofresp_message_is_proto_plus andresponse_type, and that you're already switching on the first to construct the responses (which you have to because they take different parameters): I suggest you don't parametrize onresponse_type and instead, in the function, do

ifresp_message_is_proto_plus:response_type=EchoResponseresponses= [EchoResponse(content="hello world"),EchoResponse(content="yes")]else:response_type=httpbody_pb2.HttpBodyresponses= [httpbody_pb2.HttpBody(content_type="hello world"),httpbody_pb2.HttpBody(content_type="yes"),        ]

parthea reacted with thumbs up emoji
Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

Fixed in5b7a4ce

Song(title="another song",date_added=datetime.datetime(2021,12,17)),
]
@pytest.mark.parametrize(
"random_split,resp_message_is_proto_plus,response_type",
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment as above: since you have theif below already, don't parametrize onresponse_type

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

Fixed in5b7a4ce

@pytest.mark.parametrize("random_split", [True,False])
deftest_next_stress(random_split):
@pytest.mark.parametrize(
"random_split,resp_message_is_proto_plus,response_type",
Copy link
Contributor

Choose a reason for hiding this comment

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

Ditto on parametrization

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

Fixed in5b7a4ce

),
Song(title='\\{"key": ["value",]}\\',composer=composer_with_relateds),
]
@pytest.mark.parametrize(
Copy link
Contributor

Choose a reason for hiding this comment

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

Ditto on parametrizing

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

Fixed in5b7a4ce

@product-auto-labelproduct-auto-labelbot added size: lPull request size is large. and removed size: mPull request size is medium. labelsFeb 13, 2024
@partheaparthea merged commitbcebc92 intomainFeb 13, 2024
@partheaparthea deleted the fix-rest-streaming branchFebruary 13, 2024 14:59
@parthea
Copy link
CollaboratorAuthor

parthea commentedFeb 13, 2024
edited
Loading

/cherry-pick v1

parthea added a commit that referenced this pull requestFeb 13, 2024
* fix: resolve issue handling protobuf responses in rest streaming* raise ValueError if response_message_cls is not a subclass of proto.Message or google.protobuf.message.Message* remove response_type from pytest.mark.parametrize* 🦉 Updates from OwlBot post-processorSeehttps://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md* add test for ValueError in response_iterator._grab()---------Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
@partheaparthea restored the fix-rest-streaming branchFebruary 13, 2024 16:50
@partheaparthea deleted the fix-rest-streaming branchFebruary 13, 2024 17:02
@parthea
Copy link
CollaboratorAuthor

/cherry-pick v1

gcp-cherry-pick-botbot pushed a commit that referenced this pull requestFeb 13, 2024
* fix: resolve issue handling protobuf responses in rest streaming* raise ValueError if response_message_cls is not a subclass of proto.Message or google.protobuf.message.Message* remove response_type from pytest.mark.parametrize* 🦉 Updates from OwlBot post-processorSeehttps://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md* add test for ValueError in response_iterator._grab()---------Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
@release-pleaserelease-pleasebot mentioned this pull requestMay 30, 2025
@release-pleaserelease-pleasebot mentioned this pull requestMay 30, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@vchudnov-gvchudnov-gvchudnov-g approved these changes

Labels

size: lPull request size is large.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@parthea@vchudnov-g@ohmayr

[8]ページ先頭

©2009-2025 Movatter.jp