Skip to content

Commit 4889422

Browse files
authored
ci: harden schema sample teardown against 500 InternalServiceError (#519)
Closes #388.
1 parent fa8c8b3 commit 4889422

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

packages/google-cloud-pubsub/samples/snippets/schema_test.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,12 @@
2020

2121
from _pytest.capture import CaptureFixture
2222
from flaky import flaky
23+
from google.api_core.exceptions import InternalServerError
2324
from google.api_core.exceptions import NotFound
2425
from google.cloud import pubsub_v1
25-
from google.cloud.pubsub import PublisherClient, SchemaServiceClient, SubscriberClient
26+
from google.cloud.pubsub import PublisherClient
27+
from google.cloud.pubsub import SchemaServiceClient
28+
from google.cloud.pubsub import SubscriberClient
2629
from google.pubsub_v1.types import Encoding
2730
import pytest
2831

@@ -59,7 +62,7 @@ def avro_schema(
5962

6063
try:
6164
schema_client.delete_schema(request={"name": avro_schema_path})
62-
except NotFound:
65+
except (NotFound, InternalServerError):
6366
pass
6467

6568

@@ -73,7 +76,7 @@ def proto_schema(
7376

7477
try:
7578
schema_client.delete_schema(request={"name": proto_schema_path})
76-
except NotFound:
79+
except (NotFound, InternalServerError):
7780
pass
7881

7982

0 commit comments

Comments
 (0)