summaryrefslogtreecommitdiffstats
path: root/test/unit/common
diff options
context:
space:
mode:
authorPrashanth Pai <ppai@redhat.com>2014-01-28 12:13:33 +0530
committerChetan Risbud <crisbud@redhat.com>2014-03-24 22:14:15 -0700
commit2014cdb9066e273cf791f38b1c8247427c76cfa9 (patch)
tree4ad9a3bd0e604ce7fdab16ed007dbdd56386f5eb /test/unit/common
parent2505d8281593730d8b31794d0fe8132417c34a48 (diff)
Add support for Object Expiration feature
Preventing access to expired objects ------------------------------------ Re-enabled accepting X-Delete-At and X-Delete-After headers. During a GET on an expired object, DiskFileExpired is raised by DiskFile class. This will result in object-server returning HTTPNotFound (404) to the client. Tracking objects to be deleted ------------------------------ Objects to be deleted are tracked using "tracker objects". These are PUT into a special account(a volume, for now). These zero size "tracker objects" have names that contain: * Expiration timestamp * Path of the actual object to be deleted Deleting actual objects from GlusterFS volume --------------------------------------------- The object-expirer daemon runs a pass once every X seconds. For every pass it makes, it queries the special account for "tracker objects". Based on (timestamp, path) present in name of "tracker objects", object-expirer then deletes the actual object and the corresponding tracker object. To run object-expirer forever: swift-init object-expirer start To run just once: swift-object-expirer -o -v /etc/swift/object-expirer.conf Caveat/Limitation: Object-expirer needs a separate account(volume) that is not used by other services like gswauth. By default, this volume is named "gsexpiring" and is configurable. More info about object expiration: http://docs.openstack.org/developer/swift/overview_expiring_objects.html Change-Id: I876995bf4f16ef4bfdff901561e0558ecf1dc38f Signed-off-by: Prashanth Pai <ppai@redhat.com> Reviewed-on: http://review.gluster.org/6891 Tested-by: Chetan Risbud <crisbud@redhat.com> Reviewed-by: pushpesh sharma <psharma@redhat.com> Tested-by: pushpesh sharma <psharma@redhat.com> Reviewed-by: Chetan Risbud <crisbud@redhat.com>
Diffstat (limited to 'test/unit/common')
-rw-r--r--test/unit/common/test_constraints.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/unit/common/test_constraints.py b/test/unit/common/test_constraints.py
index 180721c..6c78d75 100644
--- a/test/unit/common/test_constraints.py
+++ b/test/unit/common/test_constraints.py
@@ -81,6 +81,10 @@ class TestConstraints(unittest.TestCase):
self.assertEqual(cnt.validate_headers(req), '')
req.headers = ['x-some-header']
self.assertEqual(cnt.validate_headers(req), '')
+ #TODO: Although we now support x-delete-at and x-delete-after,
+ #retained this test case as we may add some other header to
+ #unsupported list in future
+ raise SkipTest
req.headers = ['x-delete-at', 'x-some-header']
self.assertNotEqual(cnt.validate_headers(req), '')
req.headers = ['x-delete-after', 'x-some-header']
@@ -96,6 +100,10 @@ class TestConstraints(unittest.TestCase):
self.assertEqual(cnt.validate_headers(req), '')
req.headers = ['x-some-header']
self.assertEqual(cnt.validate_headers(req), '')
+ #TODO: Although we now support x-delete-at and x-delete-after,
+ #retained this test case as we may add some other header to
+ #unsupported list in future
+ raise SkipTest
req.headers = ['x-delete-at', 'x-some-header']
self.assertEqual(cnt.validate_headers(req), '')
req.headers = ['x-delete-after', 'x-some-header']
@@ -115,6 +123,10 @@ class TestConstraints(unittest.TestCase):
self.assertTrue(1, mock_check_metadata.call_count)
req.headers = ['x-some-header']
self.assertEqual(cnt.gluster_check_metadata(req, 'object', POST=False), None)
+ #TODO: Although we now support x-delete-at and x-delete-after,
+ #retained this test case as we may add some other header to
+ #unsupported list in future
+ raise SkipTest
req.headers = ['x-delete-at', 'x-some-header']
self.assertNotEqual(cnt.gluster_check_metadata(req, 'object', POST=False), None)
req.headers = ['x-delete-after', 'x-some-header']
@@ -135,5 +147,9 @@ class TestConstraints(unittest.TestCase):
req = Mock()
req.headers = []
self.assertTrue(cnt.gluster_check_object_creation(req, 'dir/.'))
+ #TODO: Although we now support x-delete-at and x-delete-after,
+ #retained this test case as we may add some other header to
+ #unsupported list in future
+ raise SkipTest
req.headers = ['x-delete-at']
self.assertTrue(cnt.gluster_check_object_creation(req, 'dir/z'))