Validate loadbalancing method when updating a pool
Validate the input for the lb_method and avoid DBIntegrityError. Change-Id: Iea3d464abdeb1ed377db2453581124742f9fb0ac Closes-Bug: #1390078
This commit is contained in:
parent
3b91568010
commit
0a2746ed53
@ -184,7 +184,9 @@ RESOURCE_ATTRIBUTE_MAP = {
|
||||
'validate': {'type:string': None},
|
||||
'is_visible': True, 'default': attr.ATTR_NOT_SPECIFIED},
|
||||
'lb_method': {'allow_post': True, 'allow_put': True,
|
||||
'validate': {'type:string': None},
|
||||
'validate': {'type:values': ['ROUND_ROBIN',
|
||||
'LEAST_CONNECTIONS',
|
||||
'SOURCE_IP']},
|
||||
'is_visible': True},
|
||||
'members': {'allow_post': False, 'allow_put': False,
|
||||
'is_visible': True},
|
||||
|
@ -1121,6 +1121,14 @@ class TestLoadBalancer(LoadBalancerPluginDbTestCase):
|
||||
(m1, m2, m3),
|
||||
('delay', 'asc'), 2, 2)
|
||||
|
||||
def test_update_pool_invalid_lb_method(self):
|
||||
with self.pool() as pool:
|
||||
update_data = {'pool': {'lb_method': 'dummy'}}
|
||||
req = self.new_update_request('pools', update_data,
|
||||
pool['pool']['id'], fmt=self.fmt)
|
||||
res = req.get_response(self.ext_api)
|
||||
self.assertEqual(webob.exc.HTTPBadRequest.code, res.status_int)
|
||||
|
||||
def test_update_pool_stats_with_no_stats(self):
|
||||
keys = ["bytes_in", "bytes_out",
|
||||
"active_connections",
|
||||
|
Loading…
Reference in New Issue
Block a user