File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1515import os
1616import unittest
1717
18+ from google .gax .errors import GaxError
19+ from grpc import StatusCode
20+ from grpc ._channel import _Rendezvous
1821import httplib2
1922
2023from gcloud import _helpers
2427
2528from retry import RetryInstanceState
2629from retry import RetryResult
30+ from retry import RetryErrors
2731from system_test_utils import EmulatorCreds
2832from system_test_utils import unique_resource_id
2933
3034
35+ def _unavailable (exc ):
36+ return _helpers .exc_to_code (exc ) == StatusCode .UNAVAILABLE
37+
38+
39+ retry_unavailable = RetryErrors ((GaxError , _Rendezvous ), _unavailable )
40+
41+
3142class Config (object ):
3243 """Run-time configuration to be modified at set-up.
3344
@@ -124,7 +135,7 @@ def test_create_subscription_w_ack_deadline(self):
124135 def test_list_subscriptions (self ):
125136 TOPIC_NAME = 'list-sub' + unique_resource_id ('-' )
126137 topic = Config .CLIENT .topic (TOPIC_NAME )
127- self .assertFalse (topic .exists ())
138+ self .assertFalse (retry_unavailable ( topic .exists ) ())
128139 topic .create ()
129140 self .to_delete .append (topic )
130141 empty , _ = topic .list_subscriptions ()
You can’t perform that action at this time.
0 commit comments