Merge "LBaaS: pass the complete healthmonitor object to driver"

This commit is contained in:
Jenkins 2013-08-09 12:47:54 +00:00 committed by Gerrit Code Review
commit 0052f7c0db
2 changed files with 20 additions and 1 deletions

View File

@ -206,8 +206,10 @@ class LoadBalancerPlugin(loadbalancer_db.LoadBalancerPluginDb,
health_monitor,
pool_id
)
monitor_id = health_monitor['health_monitor']['id']
hm = self.get_health_monitor(context, monitor_id)
self.driver.create_pool_health_monitor(
context, health_monitor, pool_id)
context, hm, pool_id)
return retval
def delete_pool_health_monitor(self, context, id, pool_id):

View File

@ -1193,6 +1193,23 @@ class TestLoadBalancer(LoadBalancerPluginDbTestCase):
health_mon2['health_monitor']['id']]},
res)
def test_driver_call_create_pool_health_monitor(self):
with mock.patch.object(self.plugin.driver,
'create_pool_health_monitor') as driver_call:
with contextlib.nested(
self.pool(),
self.health_monitor()
) as (pool, hm):
data = {"health_monitor": {
"id": hm['health_monitor']['id'],
'tenant_id': self._tenant_id}}
self.plugin.create_pool_health_monitor(
context.get_admin_context(),
data, pool['pool']['id']
)
driver_call.assert_called_once_with(
mock.ANY, hm['health_monitor'], pool['pool']['id'])
def test_create_pool_healthmon_invalid_pool_id(self):
with self.health_monitor() as healthmon:
self.assertRaises(loadbalancer.PoolNotFound,