-
Notifications
You must be signed in to change notification settings - Fork 207
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(samples): Update Topic with Kinesis Ingestion Settings (#1123)
Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
- Loading branch information
1 parent
83dc9ff
commit e0e2d83
Showing
2 changed files
with
113 additions
and
2 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
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 |
---|---|---|
|
@@ -123,6 +123,9 @@ def test_create( | |
out, _ = capsys.readouterr() | ||
assert f"Created topic: {topic_path}" in out | ||
|
||
# Clean up resource created for the test. | ||
publisher_client.delete_topic(request={"topic": topic_path}) | ||
|
||
|
||
def test_create_kinesis_ingestion( | ||
publisher_client: pubsub_v1.PublisherClient, capsys: CaptureFixture[str] | ||
|
@@ -155,6 +158,49 @@ def test_create_kinesis_ingestion( | |
out, _ = capsys.readouterr() | ||
assert f"Created topic: {topic_path} with AWS Kinesis Ingestion Settings" in out | ||
|
||
# Clean up resource created for the test. | ||
publisher_client.delete_topic(request={"topic": topic_path}) | ||
|
||
|
||
def test_update_kinesis_ingestion( | ||
publisher_client: pubsub_v1.PublisherClient, capsys: CaptureFixture[str] | ||
) -> None: | ||
# The scope of `topic_path` is limited to this function. | ||
topic_path = publisher_client.topic_path(PROJECT_ID, TOPIC_ID) | ||
|
||
# Outside of automated CI tests, these values must be of actual AWS resources for the test to pass. | ||
stream_arn = "arn:aws:kinesis:us-west-2:111111111111:stream/fake-stream-name" | ||
consumer_arn = "arn:aws:kinesis:us-west-2:111111111111:stream/fake-stream-name/consumer/consumer-1:1111111111" | ||
aws_role_arn = "arn:aws:iam::111111111111:role/fake-role-name" | ||
gcp_service_account = ( | ||
"[email protected]" | ||
) | ||
|
||
try: | ||
publisher_client.delete_topic(request={"topic": topic_path}) | ||
except NotFound: | ||
pass | ||
|
||
publisher.create_topic(PROJECT_ID, TOPIC_ID) | ||
|
||
out, _ = capsys.readouterr() | ||
assert f"Created topic: {topic_path}" in out | ||
|
||
publisher.update_topic_kinesis_ingestion( | ||
PROJECT_ID, | ||
TOPIC_ID, | ||
stream_arn, | ||
consumer_arn, | ||
aws_role_arn, | ||
gcp_service_account, | ||
) | ||
|
||
out, _ = capsys.readouterr() | ||
assert f"Updated topic: {topic_path} with AWS Kinesis Ingestion Settings" in out | ||
|
||
# Clean up resource created for the test. | ||
publisher_client.delete_topic(request={"topic": topic_path}) | ||
|
||
|
||
def test_list(topic_path: str, capsys: CaptureFixture[str]) -> None: | ||
publisher.list_topics(PROJECT_ID) | ||
|