Skip to content

Commit

Permalink
add test case when raise ServiceUnavailable in is_retryable (#1224)
Browse files Browse the repository at this point in the history
* raise ServiceUnavailable and test that it is retry-able

---------

Co-authored-by: Mike Alfare <[email protected]>
  • Loading branch information
jx2lee and mikealfare authored Oct 24, 2024
1 parent d4be89a commit 79fbd90
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .changes/unreleased/Features-20240505-011838.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Features
body: add is_retryable test case when raise ServiceUnavailable
time: 2024-05-05T01:18:38.737882+09:00
custom:
Author: jx2lee
Issue: "682"
2 changes: 2 additions & 0 deletions tests/unit/test_bigquery_connection_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,14 @@ def test_is_retryable(self):
rate_limit_error = exceptions.Forbidden(
"code broke", errors=[{"reason": "rateLimitExceeded"}]
)
service_unavailable_error = exceptions.ServiceUnavailable("service is unavailable")

self.assertTrue(_is_retryable(internal_server_error))
self.assertTrue(_is_retryable(bad_request_error))
self.assertTrue(_is_retryable(connection_error))
self.assertFalse(_is_retryable(client_error))
self.assertTrue(_is_retryable(rate_limit_error))
self.assertTrue(_is_retryable(service_unavailable_error))

def test_drop_dataset(self):
mock_table = Mock()
Expand Down

0 comments on commit 79fbd90

Please sign in to comment.