Update functional tests for swift changes

It seems that a couple of changes to the store calls have slipped
through unnoticed:

* store.add() now returns a 4-tuple
* x-container-read and x-container-write headers use tenant:user rather
  than just tenant.

fixes bug 1236339

Change-Id: Ic5c311bcc2999e13203e0d3ad37bce5ac5f27e2d
This commit is contained in:
Thomas Leaman 2013-10-07 14:24:03 +00:00
parent 5048ceea98
commit 18581b3370

View File

@ -196,9 +196,9 @@ class TestSwiftStore(store_tests.BaseTestCase, testtools.TestCase):
image_size = 5242880 # 5 MB image_size = 5242880 # 5 MB
image_data = StringIO.StringIO('X' * image_size) image_data = StringIO.StringIO('X' * image_size)
image_checksum = 'eb7f8c3716b9f059cee7617a4ba9d0d3' image_checksum = 'eb7f8c3716b9f059cee7617a4ba9d0d3'
uri, add_size, add_checksum = store.add(image_id, uri, add_size, add_checksum, _ = store.add(image_id,
image_data, image_data,
image_size) image_size)
self.assertEqual(image_size, add_size) self.assertEqual(image_size, add_size)
self.assertEqual(image_checksum, add_checksum) self.assertEqual(image_checksum, add_checksum)
@ -335,7 +335,7 @@ class TestSwiftStore(store_tests.BaseTestCase, testtools.TestCase):
image_id = uuidutils.generate_uuid() image_id = uuidutils.generate_uuid()
image_data = StringIO.StringIO('XXX') image_data = StringIO.StringIO('XXX')
uri, _, _ = store.add(image_id, image_data, 3) uri, _, _, _ = store.add(image_id, image_data, 3)
location = glance.store.location.Location( location = glance.store.location.Location(
self.store_name, self.store_name,
@ -352,14 +352,16 @@ class TestSwiftStore(store_tests.BaseTestCase, testtools.TestCase):
container_name = location.store_location.container container_name = location.store_location.container
container, _ = swift_get_container(self.swift_client, container_name) container, _ = swift_get_container(self.swift_client, container_name)
self.assertEqual(read_tenant, container.get('x-container-read')) self.assertEqual(read_tenant + ':*',
self.assertEqual(write_tenant, container.get('x-container-write')) container.get('x-container-read'))
self.assertEqual(write_tenant + ':*',
container.get('x-container-write'))
store.set_acls(location, public=True, read_tenants=[read_tenant]) store.set_acls(location, public=True, read_tenants=[read_tenant])
container_name = location.store_location.container container_name = location.store_location.container
container, _ = swift_get_container(self.swift_client, container_name) container, _ = swift_get_container(self.swift_client, container_name)
self.assertEqual('.r:*', container.get('x-container-read')) self.assertEqual('.r:*,.rlistings', container.get('x-container-read'))
self.assertEqual('', container.get('x-container-write', '')) self.assertEqual('', container.get('x-container-write', ''))
(get_iter, get_size) = store.get(location) (get_iter, get_size) = store.get(location)