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

test: clean up extra topics from snippet tests #324

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

Merged
merged 2 commits into from
Jun 15, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions 11 samples/snippets/usage_guide.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,13 +264,19 @@ def _sink_pubsub_setup(client):
) # API call
# [END sink_topic_permissions]

return topic
# create callback wrapper to delete topic when done
class TopicDeleter:
def delete(self):
client.delete_topic(request={"topic": topic_path})

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: perhaps, worth adding a log line that topic X is deleted - for easier troubleshooting if tests fail in the future


return topic, TopicDeleter()


@snippet
def sink_pubsub(client, to_delete):
"""Sink log entries to pubsub."""
topic = _sink_pubsub_setup(client)
topic, topic_deleter = _sink_pubsub_setup(client)
to_delete.append(topic_deleter)
sink_name = "robots-pubsub-%d" % (_millis(),)
filter_str = "logName:apache-access AND textPayload:robot"
updated_filter = "textPayload:robot"
Expand All @@ -282,6 +288,7 @@ def sink_pubsub(client, to_delete):
sink.create() # API call
assert sink.exists() # API call
# [END sink_pubsub_create]
to_delete.append(sink)
created_sink = sink

# [START client_list_sinks]
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.