summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPushpesh Sharma <psharma@redhat.com>2013-09-16 20:28:06 +0530
committerLuis Pabon <lpabon@redhat.com>2013-10-01 14:30:22 -0700
commit577ccbccd2e2464365ab89e20bd35db60375caf1 (patch)
treeadb8c909ca1da801bb18a2be7455124169a52636
parentb79aa55603a9142760ea5bb11a342de9294bc390 (diff)
Added functional test for object manifest
The Object manifest is way to support large objects. http://docs.openstack.org/developer/swift/overview_large_objects.html. This functional test upload a random data in to segments. Create a manifest object to connect all these segments. Issue a GET request to manifest object and match this data with the original unsegmented data. Change-Id: I4ca3f4b4e4540f3121c75db50280ef214836a8d1 Signed-off-by: Pushpesh Sharma <psharma@redhat.com> Reviewed-on: http://review.gluster.org/5945 Reviewed-by: Luis Pabon <lpabon@redhat.com> Tested-by: Luis Pabon <lpabon@redhat.com>
-rw-r--r--test/functional/tests.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/functional/tests.py b/test/functional/tests.py
index b16e829..4536d0b 100644
--- a/test/functional/tests.py
+++ b/test/functional/tests.py
@@ -1567,6 +1567,33 @@ class TestFile(Base):
info = file.info()
self.assertEquals(etag, info['etag'])
+ def testObjectManifest(self):
+ if (web_front_end == 'apache2'):
+ raise SkipTest()
+ data = File.random_data(10000)
+ parts = random.randrange(2,10)
+ charsEachPart = len(data)/parts
+ for i in range(parts+1):
+ if i==0 :
+ file = self.env.container.file('objectmanifest')
+ hdrs={}
+ hdrs['Content-Length']='0'
+ hdrs['X-Object-Manifest']=str(self.env.container.name)+'/objectmanifest'
+ self.assert_(file.write('',hdrs=hdrs))
+ self.assert_(file.name in self.env.container.files())
+ self.assert_(file.read() == '')
+ elif i==parts :
+ file = self.env.container.file('objectmanifest'+'-'+str(i))
+ segment=data[ (i-1)*charsEachPart :]
+ self.assertTrue(file.write(segment))
+ else :
+ file = self.env.container.file('objectmanifest'+'-'+str(i))
+ segment=data[ (i-1)*charsEachPart : i*charsEachPart]
+ self.assertTrue(file.write(segment))
+ #matching the manifest file content with orignal data, as etag won't match
+ file = self.env.container.file('objectmanifest')
+ data_read = file.read()
+ self.assertEquals(data,data_read)
class TestFileUTF8(Base2, TestFile):
set_up = False