Fix check redirect pool for creating a fully populated load balancer.
Change-Id: Id0f347f9d89e6ca801edb9044302216da4ffbb3b Story: 2004961
This commit is contained in:
parent
ddcae3e229
commit
05e16a3498
@ -445,7 +445,7 @@ class LoadBalancersController(base.BaseController):
|
||||
pool_name = (
|
||||
redirect_pool.get('name') if redirect_pool else None)
|
||||
# All pools need to have a name so they can be referenced
|
||||
if default_pool and not pool_name:
|
||||
if redirect_pool and not pool_name:
|
||||
raise exceptions.ValidationException(
|
||||
detail='Pools must be named when creating a fully '
|
||||
'populated loadbalancer.')
|
||||
@ -456,7 +456,7 @@ class LoadBalancersController(base.BaseController):
|
||||
policy['redirect_pool'] = {'name': pool_name}
|
||||
pools.append(redirect_pool)
|
||||
# Otherwise, it's a reference and we record it and move on
|
||||
elif default_pool:
|
||||
elif redirect_pool:
|
||||
pools_required.add(pool_name)
|
||||
|
||||
# Make sure all pool names are unique.
|
||||
|
@ -2673,6 +2673,27 @@ class TestLoadBalancerGraph(base.BaseAPITest):
|
||||
api_lb = response.json.get(self.root_tag)
|
||||
self._assert_graphs_equal(expected_lb, api_lb)
|
||||
|
||||
def test_with_l7policies_one_redirect_url_with_default_pool(self):
|
||||
create_pool, expected_pool = self._get_pool_bodies(create_members=[],
|
||||
expected_members=[])
|
||||
create_l7rules, expected_l7rules = self._get_l7rules_bodies()
|
||||
create_l7policies, expected_l7policies = self._get_l7policies_bodies(
|
||||
create_l7rules=create_l7rules,
|
||||
expected_l7rules=expected_l7rules)
|
||||
create_listener, expected_listener = self._get_listener_bodies(
|
||||
create_default_pool_name=create_pool['name'],
|
||||
create_l7policies=create_l7policies,
|
||||
expected_l7policies=expected_l7policies,
|
||||
)
|
||||
create_lb, expected_lb = self._get_lb_bodies(
|
||||
create_listeners=[create_listener],
|
||||
expected_listeners=[expected_listener],
|
||||
create_pools=[create_pool])
|
||||
body = self._build_body(create_lb)
|
||||
response = self.post(self.LBS_PATH, body)
|
||||
api_lb = response.json.get(self.root_tag)
|
||||
self._assert_graphs_equal(expected_lb, api_lb)
|
||||
|
||||
def test_with_l7policies_redirect_pools_no_rules(self):
|
||||
create_pool, expected_pool = self._get_pool_bodies()
|
||||
create_l7policies, expected_l7policies = self._get_l7policies_bodies(
|
||||
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
Fixes creating a fully populated load balancer with not REDIRECT_POOL
|
||||
type L7 policy and default_pool field.
|
Loading…
Reference in New Issue
Block a user