Skip to content
This repository was archived by the owner on Nov 12, 2025. It is now read-only.

chore: test that ServiceUnavailable is retried#970

Merged
tswast merged 2 commits intomainfrom
issue969-serviceunavailable
Aug 14, 2025
Merged

chore: test that ServiceUnavailable is retried#970
tswast merged 2 commits intomainfrom
issue969-serviceunavailable

Conversation

@tswast
Copy link
Copy Markdown
Contributor

@tswast tswast commented Aug 13, 2025

I wrote this test while investigating #969. Turns out that the default retry is working fine, but for some reason BigFrames is turning it off.

Even though it didn't uncover any bugs here, I think it could be useful still to have this test here.

Fixes #969 🦕

@tswast tswast requested review from a team and alvarowolfx August 13, 2025 14:44
@product-auto-label product-auto-label bot added size: m Pull request size is medium. api: bigquerystorage Issues related to the googleapis/python-bigquery-storage API. labels Aug 13, 2025
@tswast tswast requested a review from Linchin August 13, 2025 14:44
@chelsea-lin chelsea-lin removed their assignment Aug 13, 2025
# validate test assumptions
assert client_under_test._transport is mock_transport

mock_transport.create_read_session.side_effect = [
Copy link
Copy Markdown
Contributor

@chalmerlowe chalmerlowe Aug 14, 2025

Choose a reason for hiding this comment

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

@tswast

QUESTION:

When we assign a list to the attribute class.method.side_effect (i.e. mock_transport.create_read_session.side_effect), every time the method gets called, the next item in the list will be produced as the result of the method call.

We have three items in the list.

One line 135 we confirm that the create_read_session method has been called thrice.
But I do not see where we make those three calls.
I see one call on line 127.

What am I missing?

Besides this question, everything else LGTM and will approve on that basis.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

But I do not see where we make those three calls.

There are several layers in the client library. To write this test, I had to figure out how to mock out the level that gets wrapped by the retry logic, which is about as low of a layer we can get in Python before it switches over to gRPC C++ stuff. The retry method is implemented as a wrapper on top of this method. So the 3 calls are my way of verifying that the first two get retried.

Copy link
Copy Markdown
Contributor

@chalmerlowe chalmerlowe left a comment

Choose a reason for hiding this comment

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

Left one Question.

@tswast tswast merged commit 132433d into main Aug 14, 2025
29 checks passed
@tswast tswast deleted the issue969-serviceunavailable branch August 14, 2025 16:29
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

api: bigquerystorage Issues related to the googleapis/python-bigquery-storage API. size: m Pull request size is medium.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ServiceUnavailable not retried after 30 minutes

3 participants