Remove skip_because in swift object expiry test
According to the comments in bug #1069849 container listing will list an expired object (normal behavior). This is up to the client to handle that a DELETE on an expired object will return a 404 error. delete_container method does not take care of any HTTP return code for object deletion. This patch remove the skip_because statement as the test works as expected and not fails in tearDownClass. This patch also add a test for metadata X-Delete-At. Change-Id: I6c6efa151fd7b64684b25b049539680a3766e0cd
This commit is contained in:
parent
bb8a67c3ab
commit
c3a9ba8435
|
@ -101,6 +101,7 @@ class BaseObjectTest(tempest.test.BaseTestCase):
|
|||
|
||||
The containers should be visible from the container_client given.
|
||||
Will not throw any error if the containers don't exist.
|
||||
Will not check that object and container deletions succeed.
|
||||
|
||||
:param containers: list of container names to remove
|
||||
:param container_client: if None, use cls.container_client, this means
|
||||
|
|
|
@ -21,7 +21,6 @@ from tempest.api.object_storage import base
|
|||
from tempest.common.utils import data_utils
|
||||
from tempest import exceptions
|
||||
from tempest.test import attr
|
||||
from tempest.test import skip_because
|
||||
|
||||
|
||||
class ObjectExpiryTest(base.BaseObjectTest):
|
||||
|
@ -33,31 +32,20 @@ class ObjectExpiryTest(base.BaseObjectTest):
|
|||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
"""The test script fails in tear down class
|
||||
as the container contains expired objects (LP bug 1069849).
|
||||
But delete action for the expired object is raising
|
||||
NotFound exception and also non empty container cannot be deleted.
|
||||
"""
|
||||
cls.delete_containers([cls.container_name])
|
||||
super(ObjectExpiryTest, cls).tearDownClass()
|
||||
|
||||
@skip_because(bug="1069849")
|
||||
@attr(type='gate')
|
||||
def test_get_object_after_expiry_time(self):
|
||||
# TODO(harika-vakadi): similar test case has to be created for
|
||||
# "X-Delete-At", after this test case works.
|
||||
|
||||
def _test_object_expiry(self, metadata):
|
||||
# create object
|
||||
object_name = data_utils.rand_name(name='TestObject')
|
||||
data = data_utils.arbitrary_string()
|
||||
resp, _ = self.object_client.create_object(self.container_name,
|
||||
object_name, data)
|
||||
# update object metadata with expiry time of 3 seconds
|
||||
metadata = {'X-Delete-After': '3'}
|
||||
object_name, '')
|
||||
# update object metadata
|
||||
resp, _ = \
|
||||
self.object_client.update_object_metadata(self.container_name,
|
||||
object_name, metadata,
|
||||
metadata_prefix='')
|
||||
# verify object metadata
|
||||
resp, _ = \
|
||||
self.object_client.list_object_metadata(self.container_name,
|
||||
object_name)
|
||||
|
@ -69,10 +57,20 @@ class ObjectExpiryTest(base.BaseObjectTest):
|
|||
self.assertEqual(resp['status'], '200')
|
||||
self.assertHeaders(resp, 'Object', 'GET')
|
||||
self.assertIn('x-delete-at', resp)
|
||||
# check data
|
||||
self.assertEqual(body, data)
|
||||
|
||||
# sleep for over 5 seconds, so that object expires
|
||||
time.sleep(5)
|
||||
|
||||
# object should not be there anymore
|
||||
self.assertRaises(exceptions.NotFound, self.object_client.get_object,
|
||||
self.container_name, object_name)
|
||||
|
||||
@attr(type='gate')
|
||||
def test_get_object_after_expiry_time(self):
|
||||
metadata = {'X-Delete-After': '3'}
|
||||
self._test_object_expiry(metadata)
|
||||
|
||||
@attr(type='gate')
|
||||
def test_get_object_at_expiry_time(self):
|
||||
metadata = {'X-Delete-At': str(int(time.time()) + 3)}
|
||||
self._test_object_expiry(metadata)
|
||||
|
|
Loading…
Reference in New Issue