Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Remove EXPERIMENTAL tag for ordering keys in publisher/client.py #324

Merged
merged 3 commits into from Mar 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 0 additions & 2 deletions google/cloud/pubsub_v1/publisher/client.py
Expand Up @@ -271,8 +271,6 @@ def publish(
ordering_key: A string that identifies related messages for which
publish order should be respected. Message ordering must be
enabled for this client to use this feature.
EXPERIMENTAL: This feature is currently available in a closed
alpha. Please contact the Cloud Pub/Sub team to use it.
retry (Optional[google.api_core.retry.Retry]): Designation of what
errors, if any, should be retried. If `ordering_key` is specified,
the total retry deadline will be changed to "infinity".
Expand Down
25 changes: 17 additions & 8 deletions samples/snippets/subscriber_test.py
Expand Up @@ -18,6 +18,7 @@

import backoff
from flaky import flaky
from google.api_core.exceptions import InternalServerError
from google.api_core.exceptions import NotFound
from google.api_core.exceptions import Unknown
from google.cloud import pubsub_v1
Expand Down Expand Up @@ -238,13 +239,14 @@ def test_create_subscription_with_dead_letter_policy(
assert f"After {DEFAULT_MAX_DELIVERY_ATTEMPTS} delivery attempts." in out


@flaky(max_runs=3, min_passes=1)
def test_receive_with_delivery_attempts(
publisher_client, topic, dead_letter_topic, subscription_dlq, capsys
):

# The dlq subscription raises 404 before it's ready.
# We keep retrying up to 10 minutes for mitigating the flakiness.
@backoff.on_exception(backoff.expo, (Unknown, NotFound), max_time=600)
@backoff.on_exception(backoff.expo, (Unknown, NotFound), max_time=120)
def run_sample():
_publish_messages(publisher_client, topic)

Expand All @@ -259,13 +261,20 @@ def run_sample():

@flaky(max_runs=3, min_passes=1)
def test_update_dead_letter_policy(subscription_dlq, dead_letter_topic, capsys):
_ = subscriber.update_subscription_with_dead_letter_policy(
PROJECT_ID,
TOPIC,
SUBSCRIPTION_DLQ,
DEAD_LETTER_TOPIC,
UPDATED_MAX_DELIVERY_ATTEMPTS,
)

# We saw internal server error that suggests to retry.

@backoff.on_exception(backoff.expo, (Unknown, InternalServerError), max_time=60)
def run_sample():
subscriber.update_subscription_with_dead_letter_policy(
PROJECT_ID,
TOPIC,
SUBSCRIPTION_DLQ,
DEAD_LETTER_TOPIC,
UPDATED_MAX_DELIVERY_ATTEMPTS,
)

run_sample()

out, _ = capsys.readouterr()
assert dead_letter_topic in out
Expand Down