From 82a645c625ab8a5077b336c40845bb65d129ce27 Mon Sep 17 00:00:00 2001 From: Tommi Virtanen Date: Thu, 28 Jul 2011 11:00:47 -0700 Subject: [PATCH] Demonstrate rgw bucket listing bug. Discovered by stumbling on the "deleted_cnt" workaround in s3tests.common. TODO: Add tests for rest of the functionality in http://docs.amazonwebservices.com/AmazonS3/latest/API/index.html?RESTBucketGET.html --- s3tests/functional/test_s3.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/s3tests/functional/test_s3.py b/s3tests/functional/test_s3.py index a93de4c..9ed53bd 100644 --- a/s3tests/functional/test_s3.py +++ b/s3tests/functional/test_s3.py @@ -61,6 +61,30 @@ def test_bucket_list_empty(): l = list(l) eq(l, []) +@attr('fails_on_rgw') +@attr('fails_on_dho') +def test_bucket_list_many(): + bucket = get_new_bucket() + keys = ['foo', 'bar', 'baz'] + for s in keys: + key = bucket.new_key(s) + key.set_contents_from_string(s) + # bucket.list() is high-level and will not set us set max-keys, + # using it would require using >1000 keys to test, and that would + # be too slow; use the lower-level call bucket.get_all_keys() + # instead + l = bucket.get_all_keys(max_keys=2) + eq(len(l), 2) + eq(l.is_truncated, True) + names = [e.name for e in l] + eq(names, ['bar', 'baz']) + + l = bucket.get_all_keys(max_keys=2, marker=names[-1]) + eq(len(l), 1) + eq(l.is_truncated, False) + names = [e.name for e in l] + eq(names, ['foo']) + def test_bucket_notexist(): name = '{prefix}foo'.format(prefix=get_prefix()) print 'Trying bucket {name!r}'.format(name=name)