-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes: #2080.
- Loading branch information
Showing
1 changed file
with
0 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -262,40 +262,3 @@ def test_subscription_iam_policy(self): | |
policy.viewers.add(policy.user('[email protected]')) | ||
new_policy = subscription.set_iam_policy(policy) | ||
self.assertEqual(new_policy.viewers, policy.viewers) | ||
|
||
# This test is ultra-flaky. See: | ||
# https://github.com/GoogleCloudPlatform/google-cloud-python/issues/2080 | ||
@unittest.expectedFailure | ||
def test_fetch_delete_subscription_w_deleted_topic(self): | ||
from google.cloud.iterator import MethodIterator | ||
TO_DELETE = 'delete-me' + unique_resource_id('-') | ||
ORPHANED = 'orphaned' + unique_resource_id('-') | ||
topic = Config.CLIENT.topic(TO_DELETE) | ||
topic.create() | ||
subscription = topic.subscription(ORPHANED) | ||
subscription.create() | ||
topic.delete() | ||
|
||
def _fetch(): | ||
return list(MethodIterator(Config.CLIENT.list_subscriptions)) | ||
|
||
def _found_orphan(result): | ||
names = [subscription.name for subscription in result] | ||
return ORPHANED in names | ||
|
||
retry_until_found_orphan = RetryResult(_found_orphan) | ||
all_subs = retry_until_found_orphan(_fetch)() | ||
|
||
created = [subscription for subscription in all_subs | ||
if subscription.name == ORPHANED] | ||
self.assertEqual(len(created), 1) | ||
orphaned = created[0] | ||
self.to_delete.append(orphaned) | ||
|
||
def _no_topic(instance): | ||
return instance.topic is None | ||
|
||
retry_until_no_topic = RetryInstanceState(_no_topic) | ||
retry_until_no_topic(orphaned.reload)() | ||
|
||
self.assertTrue(orphaned.topic is None) |