Tighten up overall metadata size tests
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 current functional tests only exercise the proxy controller checks, since they test for a 400 when sending excessive metadata in a single POST. This patch adds a test for a 400 when a single metadata item in a POST causes the backend aggregate constraints check to go over limit. The extra coverage of the new assertions can be seen by modifying swift/common/db.DatabasBroker.validate_metadata() to always return None immediately - only the new assertions fail when functests are run. Change-Id: I1489e29686013cbd3d70283d8756b548aea3c2e1
This commit is contained in:
@@ -827,11 +827,19 @@ class TestAccount(unittest.TestCase):
|
||||
resp = retry(post, headers)
|
||||
resp.read()
|
||||
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)
|
||||
resp = retry(post, headers)
|
||||
resp.read()
|
||||
self.assertEqual(resp.status, 400)
|
||||
# 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)}
|
||||
resp = retry(post, headers)
|
||||
resp.read()
|
||||
self.assertEqual(resp.status, 400)
|
||||
|
||||
|
||||
class TestAccountInNonDefaultDomain(unittest.TestCase):
|
||||
|
@@ -449,11 +449,19 @@ class TestContainer(unittest.TestCase):
|
||||
resp = retry(post, headers)
|
||||
resp.read()
|
||||
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)
|
||||
resp = retry(post, headers)
|
||||
resp.read()
|
||||
self.assertEqual(resp.status, 400)
|
||||
# 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)}
|
||||
resp = retry(post, headers)
|
||||
resp.read()
|
||||
self.assertEqual(resp.status, 400)
|
||||
|
||||
def test_public_container(self):
|
||||
if tf.skip:
|
||||
|
Reference in New Issue
Block a user