LBaaS plugin returns unnecessary information for PING and TCP health monitors
Fixes Bug #1100749 Change-Id: Id1e22621b398786f3d6b670f53b6e23e7fb89786
This commit is contained in:
parent
f45a0153b8
commit
6f6499700a
@ -603,11 +603,14 @@ class LoadBalancerPluginDb(LoadBalancerPluginBase):
|
|||||||
'delay': health_monitor['delay'],
|
'delay': health_monitor['delay'],
|
||||||
'timeout': health_monitor['timeout'],
|
'timeout': health_monitor['timeout'],
|
||||||
'max_retries': health_monitor['max_retries'],
|
'max_retries': health_monitor['max_retries'],
|
||||||
'http_method': health_monitor['http_method'],
|
|
||||||
'url_path': health_monitor['url_path'],
|
|
||||||
'expected_codes': health_monitor['expected_codes'],
|
|
||||||
'admin_state_up': health_monitor['admin_state_up'],
|
'admin_state_up': health_monitor['admin_state_up'],
|
||||||
'status': health_monitor['status']}
|
'status': health_monitor['status']}
|
||||||
|
# no point to add the values below to
|
||||||
|
# the result if the 'type' is not HTTP/S
|
||||||
|
if res['type'] in ['HTTP', 'HTTPS']:
|
||||||
|
for attr in ['url_path', 'http_method', 'expected_codes']:
|
||||||
|
res[attr] = health_monitor[attr]
|
||||||
|
|
||||||
return self._fields(res, fields)
|
return self._fields(res, fields)
|
||||||
|
|
||||||
def create_health_monitor(self, context, health_monitor):
|
def create_health_monitor(self, context, health_monitor):
|
||||||
|
@ -366,12 +366,24 @@ class LoadBalancerPluginDbTestCase(unittest2.TestCase):
|
|||||||
admin_status_up,
|
admin_status_up,
|
||||||
**kwargs)
|
**kwargs)
|
||||||
health_monitor = self.deserialize(fmt, res)
|
health_monitor = self.deserialize(fmt, res)
|
||||||
|
the_health_monitor = health_monitor['health_monitor']
|
||||||
if res.status_int >= 400:
|
if res.status_int >= 400:
|
||||||
raise webob.exc.HTTPClientError(code=res.status_int)
|
raise webob.exc.HTTPClientError(code=res.status_int)
|
||||||
|
# make sure:
|
||||||
|
# 1. When the type is HTTP/S we have HTTP related attributes in
|
||||||
|
# the result
|
||||||
|
# 2. When the type is not HTTP/S we do not have HTTP related
|
||||||
|
# attributes in the result
|
||||||
|
http_related_attributes = ('http_method', 'url_path', 'expected_codes')
|
||||||
|
if type in ['HTTP', 'HTTPS']:
|
||||||
|
for arg in http_related_attributes:
|
||||||
|
self.assertIsNotNone(the_health_monitor.get(arg))
|
||||||
|
else:
|
||||||
|
for arg in http_related_attributes:
|
||||||
|
self.assertIsNone(the_health_monitor.get(arg))
|
||||||
yield health_monitor
|
yield health_monitor
|
||||||
if not no_delete:
|
if not no_delete:
|
||||||
self._delete('health_monitors',
|
self._delete('health_monitors', the_health_monitor['id'])
|
||||||
health_monitor['health_monitor']['id'])
|
|
||||||
|
|
||||||
|
|
||||||
class TestLoadBalancer(LoadBalancerPluginDbTestCase):
|
class TestLoadBalancer(LoadBalancerPluginDbTestCase):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user