summaryrefslogtreecommitdiff
path: root/test/functional/test_account.py
diff options
context:
space:
mode:
authorYuan Zhou <yuan.zhou@intel.com>2014-04-09 19:15:04 +0800
committerClay Gerrard <clay.gerrard@gmail.com>2014-06-18 20:57:09 -0700
commitc11ac012522a7e742ac942637af12a3e090d53ef (patch)
tree8539987f5496a59b580bcc5ea7ef935f8769c06e /test/functional/test_account.py
parentb02f0db126b873902bdb63f94a3c412082e14a54 (diff)
downloadswift-c11ac012522a7e742ac942637af12a3e090d53ef.tar.gz
Add functional tests for Storage Policy
* additional container tests * refactor test cross policy copy * make functional tests cleanup better In-process functional tests only define a single ring and will skip some of the multi-storage policy tests, but have been updated to reload_policies with the patched swift.conf. DocImpact Implements: blueprint storage-policies Change-Id: If17bc7b9737558d3b9a54eeb6ff3e6b51463f002
Diffstat (limited to 'test/functional/test_account.py')
-rwxr-xr-xtest/functional/test_account.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/functional/test_account.py b/test/functional/test_account.py
index 3ee7fa2ac..b6b279d08 100755
--- a/test/functional/test_account.py
+++ b/test/functional/test_account.py
@@ -36,6 +36,36 @@ class TestAccount(unittest.TestCase):
self.max_meta_overall_size = load_constraint('max_meta_overall_size')
self.max_meta_value_length = load_constraint('max_meta_value_length')
+ def head(url, token, parsed, conn):
+ conn.request('HEAD', parsed.path, '', {'X-Auth-Token': token})
+ return check_response(conn)
+ resp = retry(head)
+ self.existing_metadata = set([
+ k for k, v in resp.getheaders() if
+ k.lower().startswith('x-account-meta')])
+
+ def tearDown(self):
+ def head(url, token, parsed, conn):
+ conn.request('HEAD', parsed.path, '', {'X-Auth-Token': token})
+ return check_response(conn)
+ resp = retry(head)
+ resp.read()
+ new_metadata = set(
+ [k for k, v in resp.getheaders() if
+ k.lower().startswith('x-account-meta')])
+
+ def clear_meta(url, token, parsed, conn, remove_metadata_keys):
+ headers = {'X-Auth-Token': token}
+ headers.update((k, '') for k in remove_metadata_keys)
+ conn.request('POST', parsed.path, '', headers)
+ return check_response(conn)
+ extra_metadata = list(self.existing_metadata ^ new_metadata)
+ for i in range(0, len(extra_metadata), 90):
+ batch = extra_metadata[i:i + 90]
+ resp = retry(clear_meta, batch)
+ resp.read()
+ self.assertEqual(resp.status // 100, 2)
+
def test_metadata(self):
if tf.skip:
raise SkipTest