Merge "Remove key "l7_policies" in pool dict"

This commit is contained in:
Zuul 2018-05-26 03:55:43 +00:00 committed by Gerrit Code Review
commit 60f214e547
2 changed files with 25 additions and 4 deletions

View File

@ -747,11 +747,12 @@ class LoadBalancerPluginDbv2(base_db.CommonDbMixin,
with context.session.begin(subtransactions=True):
hm_db = self.create_healthmonitor(context, healthmonitor)
pool = self.get_pool(context, pool_id)
# do not want listener, members, healthmonitor or loadbalancer
# in dict
# do not want listener, members, l7_policies, healthmonitor
# or loadbalancer in dict
pool_dict = pool.to_dict(listeners=False, members=False,
healthmonitor=False, loadbalancer=False,
listener=False, loadbalancer_id=False)
l7_policies=False, healthmonitor=False,
loadbalancer=False, listener=False,
loadbalancer_id=False)
pool_dict['healthmonitor_id'] = hm_db.id
self.update_pool(context, pool_id, pool_dict)
hm_db = self._get_resource(context, models.HealthMonitorV2,

View File

@ -3261,6 +3261,26 @@ class TestLbaasHealthMonitorTests(HealthMonitorTestBase):
pool_id=self.pool_id, hm_id=hm_id)
return healthmonitor
def test_create_healthmonitor_with_l7policy_redirect_pool(self):
with self.listener(loadbalancer_id=self.lb_id,
protocol_port=84) as listener:
listener_id = listener['listener']['id']
pool = self._create_pool(
self.fmt, lb_const.PROTOCOL_HTTP,
lb_const.LB_METHOD_ROUND_ROBIN,
loadbalancer_id=self.lb_id)
pool = self.deserialize(self.fmt, pool)
pool_id = pool['pool']['id']
with self.l7policy(
listener_id,
action=lb_const.L7_POLICY_ACTION_REDIRECT_TO_POOL,
redirect_pool_id=pool_id):
self._create_healthmonitor(
None, pool_id=pool_id,
type='TCP', delay=1,
timeout=1, max_retries=1,
expected_res_status=webob.exc.HTTPCreated.code)
def test_show_healthmonitor_with_type_tcp(self, **extras):
expected = {
'type': 'TCP',