Add metadata size tests on the border

This patch adds a test for a 204 when a single metadata item in a POST causes
the backend aggregate constraints check to be on the border.

Background:
Overall metadata size constraint is enforced in the container and
account backends as well as in the proxy controllers.
Whereas the proxy controller can check that constraints are not exceeded
by a single PUT or POST request, the backend checks that constraints are not
exceeded by the aggregate of all PUTs and POSTs.

The change [1] added a test for a 400 when a single metadata item in
a POST causes the backend aggregate constraints check to go over limit.

[1] I1489e29686013cbd3d70283d8756b548aea3c2e1

Change-Id: Iac86ea71240ddde177e625c279c21aef67659d10
This commit is contained in:
Hisashi Osanai 2015-06-02 17:00:42 +09:00 committed by Alistair Coles
parent 1c8f675958
commit 93de6c73e5
2 changed files with 18 additions and 4 deletions

@ -829,14 +829,21 @@ class TestAccount(unittest.TestCase):
self.assertEqual(resp.status, 204)
# this POST includes metadata size that is over limit
headers['X-Account-Meta-k'] = \
'v' * (self.max_meta_overall_size - size)
'x' * (self.max_meta_overall_size - size)
resp = retry(post, headers)
resp.read()
self.assertEqual(resp.status, 400)
# this POST would be ok and the aggregate backend metadata
# size is on the border
headers = {'X-Account-Meta-k':
'y' * (self.max_meta_overall_size - size - 1)}
resp = retry(post, headers)
resp.read()
self.assertEqual(resp.status, 204)
# this last POST would be ok by itself but takes the aggregate
# backend metadata size over limit
headers = {'X-Account-Meta-k':
'v' * (self.max_meta_overall_size - size)}
'z' * (self.max_meta_overall_size - size)}
resp = retry(post, headers)
resp.read()
self.assertEqual(resp.status, 400)

@ -451,14 +451,21 @@ class TestContainer(unittest.TestCase):
self.assertEqual(resp.status, 204)
# this POST includes metadata size that is over limit
headers['X-Container-Meta-k'] = \
'v' * (self.max_meta_overall_size - size)
'x' * (self.max_meta_overall_size - size)
resp = retry(post, headers)
resp.read()
self.assertEqual(resp.status, 400)
# this POST would be ok and the aggregate backend metadata
# size is on the border
headers = {'X-Container-Meta-k':
'y' * (self.max_meta_overall_size - size - 1)}
resp = retry(post, headers)
resp.read()
self.assertEqual(resp.status, 204)
# this last POST would be ok by itself but takes the aggregate
# backend metadata size over limit
headers = {'X-Container-Meta-k':
'v' * (self.max_meta_overall_size - size)}
'z' * (self.max_meta_overall_size - size)}
resp = retry(post, headers)
resp.read()
self.assertEqual(resp.status, 400)