From 93de6c73e587a672663fa0997f439b73b336769c Mon Sep 17 00:00:00 2001 From: Hisashi Osanai Date: Tue, 2 Jun 2015 17:00:42 +0900 Subject: [PATCH] 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 --- test/functional/test_account.py | 11 +++++++++-- test/functional/test_container.py | 11 +++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/test/functional/test_account.py b/test/functional/test_account.py index d0d18c0529..0bd7b886c3 100755 --- a/test/functional/test_account.py +++ b/test/functional/test_account.py @@ -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) diff --git a/test/functional/test_container.py b/test/functional/test_container.py index 5de866b97e..de72526de6 100755 --- a/test/functional/test_container.py +++ b/test/functional/test_container.py @@ -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)