Skip to content

Commit fccd91b

Browse files
authored
Merge pull request #2181 from dhermes/fix-2180
Add eventual consistency check for storage list_blobs()
2 parents cf59650 + 2407e4d commit fccd91b

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

system_tests/storage.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
from system_test_utils import unique_resource_id
3030
from retry import RetryErrors
31+
from retry import RetryResult
3132

3233

3334
retry_429 = RetryErrors(exceptions.TooManyRequests)
@@ -225,8 +226,16 @@ def tearDownClass(cls):
225226
blob.delete()
226227

227228
def test_list_files(self):
228-
all_blobs = list(self.bucket.list_blobs())
229-
self.assertEqual(len(all_blobs), len(self.FILENAMES))
229+
def _all_in_list(blobs):
230+
return len(blobs) == len(self.FILENAMES)
231+
232+
def _all_blobs():
233+
return list(self.bucket.list_blobs())
234+
235+
retry = RetryResult(_all_in_list)
236+
all_blobs = retry(_all_blobs)()
237+
self.assertEqual(sorted(blob.name for blob in all_blobs),
238+
sorted(self.FILENAMES))
230239

231240
def test_paginate_files(self):
232241
truncation_size = 1

0 commit comments

Comments
 (0)