Merge "have all quota errors return an http 413"
This commit is contained in:
commit
e08eeea94f
@ -478,7 +478,8 @@ class Controller(wsgi.Controller):
|
||||
raise exc.HTTPRequestEntityTooLarge(explanation=expl,
|
||||
headers={'Retry-After': 0})
|
||||
# if the original error is okay, just reraise it
|
||||
raise error
|
||||
raise exc.HTTPRequestEntityTooLarge(explanation=error.msg,
|
||||
headers={'Retry-After': 0})
|
||||
|
||||
def _validate_server_name(self, value):
|
||||
if not isinstance(value, basestring):
|
||||
|
@ -1605,6 +1605,32 @@ class ServersControllerCreateTest(test.TestCase):
|
||||
self.assertEqual(FLAGS.password_length, len(server['adminPass']))
|
||||
self.assertEqual(FAKE_UUID, server['id'])
|
||||
|
||||
def test_create_instance_too_much_metadata(self):
|
||||
self.flags(quota_metadata_items=1)
|
||||
image_uuid = '76fa36fc-c930-4bf3-8c8a-ea2a2420deb6'
|
||||
image_href = 'http://localhost/v2/images/%s' % image_uuid
|
||||
flavor_ref = 'http://localhost/123/flavors/3'
|
||||
body = {
|
||||
'server': {
|
||||
'name': 'server_test',
|
||||
'imageRef': image_href,
|
||||
'flavorRef': flavor_ref,
|
||||
'metadata': {
|
||||
'hello': 'world',
|
||||
'open': 'stack',
|
||||
'vote': 'fiddletown',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
req = fakes.HTTPRequest.blank('/v2/fake/servers')
|
||||
req.method = 'POST'
|
||||
req.body = json.dumps(body)
|
||||
req.headers["content-type"] = "application/json"
|
||||
|
||||
self.assertRaises(webob.exc.HTTPRequestEntityTooLarge,
|
||||
self.controller.create, req, body)
|
||||
|
||||
def test_create_instance_invalid_key_name(self):
|
||||
image_href = 'http://localhost/v2/images/2'
|
||||
flavor_ref = 'http://localhost/flavors/3'
|
||||
|
Loading…
Reference in New Issue
Block a user