Skip to content

Commit

Permalink
Add eventual consistency check for storage list_blobs()
Browse files Browse the repository at this point in the history
  • Loading branch information
dhermes committed Aug 24, 2016
1 parent cf59650 commit 2407e4d
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 2407e4d

Please sign in to comment.