Skip to content

Commit 8738b67

Browse files
author
Takashi Matsuo
authored
testing(videointelligence): retry harder upon 409s (#4361)
fixes #4354
1 parent c6fc919 commit 8738b67

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

video/cloud-client/analyze/beta_snippets_test.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
import os
1818
import uuid
1919

20+
import backoff
21+
from google.api_core.exceptions import Conflict
2022
from google.cloud import storage
2123
import pytest
2224
from six.moves.urllib.request import urlopen
@@ -59,8 +61,13 @@ def bucket():
5961

6062
yield bucket
6163

62-
# Teardown.
63-
bucket.delete(force=True)
64+
# Teardown. We're occasionally seeing 409 conflict errors.
65+
# Retrying upon 409s.
66+
@backoff.on_exception(backoff.expo, Conflict, max_time=120)
67+
def delete_bucket():
68+
bucket.delete(force=True)
69+
70+
delete_bucket()
6471

6572

6673
@pytest.mark.slow
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
backoff==1.10.0
12
pytest==5.4.3
2-
flaky==3.7.0
3+
flaky==3.7.0

0 commit comments

Comments
 (0)