Disallow 'timeout' in health_monitor to be negative
It should limit the value of 'timeout' in 'health_monitor', the 'timeout' shouldn't to be negative. Change-Id: I26ae1995c9cc362df7c7dda4c53fb8adda298d13 Closes-bug: #1320062
This commit is contained in:
parent
2cd747021a
commit
12a978d331
@ -250,6 +250,7 @@ RESOURCE_ATTRIBUTE_MAP = {
|
||||
'convert_to': attr.convert_to_int,
|
||||
'is_visible': True},
|
||||
'timeout': {'allow_post': True, 'allow_put': True,
|
||||
'validate': {'type:non_negative': None},
|
||||
'convert_to': attr.convert_to_int,
|
||||
'is_visible': True},
|
||||
'max_retries': {'allow_post': True, 'allow_put': True,
|
||||
|
@ -348,6 +348,23 @@ class LoadBalancerExtensionTestCase(test_api_v2_extension.ExtensionTestCase):
|
||||
self.assertIn('health_monitor', res)
|
||||
self.assertEqual(res['health_monitor'], return_value)
|
||||
|
||||
def test_health_monitor_create_with_timeout_negative(self):
|
||||
data = {'health_monitor': {'type': 'HTTP',
|
||||
'delay': 2,
|
||||
'timeout': -1,
|
||||
'max_retries': 3,
|
||||
'http_method': 'GET',
|
||||
'url_path': '/path',
|
||||
'expected_codes': '200-300',
|
||||
'admin_state_up': True,
|
||||
'tenant_id': _uuid()}}
|
||||
res = self.api.post(_get_path('lb/health_monitors',
|
||||
fmt=self.fmt),
|
||||
self.serialize(data),
|
||||
content_type='application/%s' % self.fmt,
|
||||
expect_errors=True)
|
||||
self.assertEqual(400, res.status_int)
|
||||
|
||||
def test_health_monitor_list(self):
|
||||
health_monitor_id = _uuid()
|
||||
return_value = [{'type': 'HTTP',
|
||||
|
Loading…
x
Reference in New Issue
Block a user