Skip to content
This repository was archived by the owner on Nov 29, 2023. It is now read-only.

Commit c98cabd

Browse files
crwilcoxdanoscarmike
authored andcommitted
fix: wait up to 20 seconds for blob to appear [(#3061)](GoogleCloudPlatform/python-docs-samples#3061)
This test fails sometimes with a 3 second wait. Extend this wait, but poll to avoid taking all the time.
1 parent 59f2fae commit c98cabd

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

samples/analyze/beta_snippets_test.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,15 @@ def test_annotation_to_storage_streaming(capsys, video_path, bucket):
101101
assert 'Storage' in out
102102

103103
# It takes a few seconds before the results show up on GCS.
104-
time.sleep(3)
104+
for _ in range(10):
105+
time.sleep(3)
106+
107+
blobs_iterator = bucket.list_blobs()
108+
blobs = [blob for blob in blobs_iterator]
109+
if len(blobs):
110+
break
105111

106112
# Confirm that one output blob had been written to GCS.
107-
blobs_iterator = bucket.list_blobs()
108-
blobs = [blob for blob in blobs_iterator]
109113
assert len(blobs) == 1
110114

111115

0 commit comments

Comments
 (0)