Skip to content

Commit

Permalink
Merge pull request #2181 from dhermes/fix-2180
Browse files Browse the repository at this point in the history
Add eventual consistency check for storage list_blobs()
  • Loading branch information
dhermes authored Aug 24, 2016
2 parents cf59650 + 2407e4d commit fccd91b
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions system_tests/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

from system_test_utils import unique_resource_id
from retry import RetryErrors
from retry import RetryResult


retry_429 = RetryErrors(exceptions.TooManyRequests)
Expand Down Expand Up @@ -225,8 +226,16 @@ def tearDownClass(cls):
blob.delete()

def test_list_files(self):
all_blobs = list(self.bucket.list_blobs())
self.assertEqual(len(all_blobs), len(self.FILENAMES))
def _all_in_list(blobs):
return len(blobs) == len(self.FILENAMES)

def _all_blobs():
return list(self.bucket.list_blobs())

retry = RetryResult(_all_in_list)
all_blobs = retry(_all_blobs)()
self.assertEqual(sorted(blob.name for blob in all_blobs),
sorted(self.FILENAMES))

def test_paginate_files(self):
truncation_size = 1
Expand Down

0 comments on commit fccd91b

Please sign in to comment.