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

Appearance settings

Commit 48701ca

Browse filesBrowse files
authored
Fix update test to use new endpoint (GoogleCloudPlatform#1925)
* Fix update test to use new endpoint * Handle subscription already exists Previous deletions don't always succeed * Use a new endpoint for update
1 parent 9677117 commit 48701ca
Copy full SHA for 48701ca

File tree

Expand file treeCollapse file tree

1 file changed

+8
-6
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+8
-6
lines changed

‎pubsub/cloud-client/subscriber_test.py

Copy file name to clipboardExpand all lines: pubsub/cloud-client/subscriber_test.py
+8-6Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
from gcp_devrel.testing import eventually_consistent
1919
from google.cloud import pubsub_v1
20+
import google.api_core.exceptions
2021
import mock
2122
import pytest
2223

@@ -28,6 +29,7 @@
2829
SUBSCRIPTION_SYNC1 = 'subscription-test-subscription-sync1'
2930
SUBSCRIPTION_SYNC2 = 'subscription-test-subscription-sync2'
3031
ENDPOINT = 'https://{}.appspot.com/push'.format(PROJECT)
32+
NEW_ENDPOINT = 'https://{}.appspot.com/push2'.format(PROJECT)
3133

3234

3335
@pytest.fixture(scope='module')
@@ -64,7 +66,10 @@ def subscription(subscriber_client, topic):
6466
except Exception:
6567
pass
6668

67-
subscriber_client.create_subscription(subscription_path, topic=topic)
69+
try:
70+
subscriber_client.create_subscription(subscription_path, topic=topic)
71+
except google.api_core.exceptions.AlreadyExists:
72+
pass
6873

6974
yield subscription_path
7075

@@ -155,13 +160,10 @@ def _():
155160

156161

157162
def test_update(subscriber_client, subscription, capsys):
158-
ACK_DEADLINE_SECONDS = 100
159-
160-
subscriber.update_subscription(PROJECT, SUBSCRIPTION, ACK_DEADLINE_SECONDS)
163+
subscriber.update_subscription(PROJECT, SUBSCRIPTION, NEW_ENDPOINT)
161164

162165
out, _ = capsys.readouterr()
163-
assert subscription in out
164-
assert '100' in out
166+
assert 'Subscription updated' in out
165167

166168

167169
def _publish_messages(publisher_client, topic):

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.