Test to upload object in segments and download it
Adds test case to "test_object_services.py" so as to check the
upload segmented objects support into a container and download
those segments into a collected data. And also a method
"create_object_segments" in object_client.py
Change-Id: I798fe73509f7504fc5fe4aa7c7c3e37799cbfe6e
implements: blueprint add-some-functional-swift-tests
diff --git a/tempest/services/object_storage/object_client.py b/tempest/services/object_storage/object_client.py
index 2256170..056dcec 100644
--- a/tempest/services/object_storage/object_client.py
+++ b/tempest/services/object_storage/object_client.py
@@ -138,6 +138,11 @@
sig, expires)
resp, body = self.get(url)
+
+ def create_object_segments(self, container, object_name, segment, data):
+ """Creates object segments."""
+ url = "{0}/{1}/{2}".format(container, object_name, segment)
+ resp, body = self.put(url, data, self.headers)
return resp, body
diff --git a/tempest/tests/object_storage/test_object_services.py b/tempest/tests/object_storage/test_object_services.py
index fc3f45f..cfcd4bb 100644
--- a/tempest/tests/object_storage/test_object_services.py
+++ b/tempest/tests/object_storage/test_object_services.py
@@ -656,3 +656,40 @@
metadata=metadata)
resp, _ = self.account_client.list_account_metadata()
self.assertNotIn('x-account-meta-temp-url-key', resp)
+
+ @attr(type='positive')
+ def test_object_upload_in_segments(self):
+ #Attempt to upload object in segments
+
+ #Create Object
+ object_name = rand_name(name='LObject')
+ data = arbitrary_string(size=len(object_name),
+ base_text=object_name)
+ segments = 10
+ self.object_client.create_object(self.container_name,
+ object_name, data)
+ #Uploading 10 segments
+ for i in range(segments):
+ resp, _ = \
+ self.object_client.create_object_segments(self.container_name,
+ object_name, i, data)
+ # Creating a Manifest File (Metadata Update)
+
+ metadata = {'X-Object-Manifest': '%s/%s/'
+ % (self.container_name, object_name)}
+ resp, _ = \
+ self.object_client.update_object_metadata(self.container_name,
+ object_name, metadata,
+ metadata_prefix='')
+ resp, _ = \
+ self.object_client.list_object_metadata(self.container_name,
+ object_name)
+ self.assertIn('x-object-manifest', resp)
+ self.assertEqual(resp['x-object-manifest'],
+ '%s/%s/' % (self.container_name, object_name))
+
+ #Downloading the object
+ resp, body = \
+ self.object_client.get_object(self.container_name, object_name)
+
+ self.assertEqual(data * segments, body)