From 5e420efc728b9f02a3f15eb312ebfa29e2e221ff Mon Sep 17 00:00:00 2001 From: Tim Burke Date: Thu, 7 Jan 2016 15:46:17 -0800 Subject: [PATCH] Fix versioned_writes functional test skipping Previously, if object versioning was enabled via the old-style allow_versions container-server setting rather than the new-style allow_versioned_writes proxy-server setting, TestCrossPolicyObjectVersioning would skip tests while TestObjectVersioning and TestObjectVersioningUTF8 would run them. Additionally, if versioned_writes was explicitly included in the proxy-server's pipeline and allow_versioned_writes was disabled, the functional tests would fail with a 412. Now, all three will use the same logic to check whether versioning is enabled. Specifically, they will all try to set an X-Versions-Location header and skip if it doesn't stick. Additionally, the TestCrossPolicyObjectVersioningEnv will now properly clean up after itself. Change-Id: I4c788a0e18587ff17d3c6e346fd22b881495f06d --- test/functional/tests.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/test/functional/tests.py b/test/functional/tests.py index c55133eb70..01249d2305 100644 --- a/test/functional/tests.py +++ b/test/functional/tests.py @@ -3213,6 +3213,9 @@ class TestObjectVersioningEnv(object): cls.container = cls.account.container(prefix + "-objs") if not cls.container.create( hdrs={'X-Versions-Location': cls.versions_container.name}): + if cls.conn.response.status == 412: + cls.versioning_enabled = False + return raise ResponseError(cls.conn.response) container_info = cls.container.info() @@ -3265,14 +3268,12 @@ class TestCrossPolicyObjectVersioningEnv(object): cls.multiple_policies_enabled = True else: cls.multiple_policies_enabled = False - cls.versioning_enabled = False + cls.versioning_enabled = True + # We don't actually know the state of versioning, but without + # multiple policies the tests should be skipped anyway. Claiming + # versioning support lets us report the right reason for skipping. return - if cls.versioning_enabled is None: - cls.versioning_enabled = 'versioned_writes' in cluster_info - if not cls.versioning_enabled: - return - policy = cls.policies.select() version_policy = cls.policies.exclude(name=policy['name']).select() @@ -3300,6 +3301,9 @@ class TestCrossPolicyObjectVersioningEnv(object): if not cls.container.create( hdrs={'X-Versions-Location': cls.versions_container.name, 'X-Storage-Policy': version_policy['name']}): + if cls.conn.response.status == 412: + cls.versioning_enabled = False + return raise ResponseError(cls.conn.response) container_info = cls.container.info() @@ -3325,6 +3329,11 @@ class TestCrossPolicyObjectVersioningEnv(object): cls.storage_url3, cls.storage_token3 = cls.conn3.authenticate() cls.account3 = cls.conn3.get_account() + @classmethod + def tearDown(cls): + cls.account.delete_containers() + cls.account2.delete_containers() + class TestObjectVersioning(Base): env = TestObjectVersioningEnv