Browse Source

Merge "Fix validation for master_lb_enabled"

changes/57/769457/1
Zuul 7 months ago
committed by Gerrit Code Review
parent
commit
f2aae8834e
  1. 2
      magnum/api/attr_validator.py
  2. 2
      magnum/tests/unit/api/controllers/v1/test_bay.py
  3. 3
      magnum/tests/unit/api/controllers/v1/test_cluster.py
  4. 2
      magnum/tests/unit/db/utils.py

2
magnum/api/attr_validator.py

@ -209,7 +209,7 @@ def validate_os_resources(context, cluster_template, cluster=None):
def validate_master_count(cluster, cluster_template):
if cluster['master_count'] > 1 and \
not cluster_template['master_lb_enabled']:
not cluster['master_lb_enabled']:
raise exception.InvalidParameterValue(_(
"master_count must be 1 when master_lb_enabled is False"))

2
magnum/tests/unit/api/controllers/v1/test_bay.py

@ -803,7 +803,7 @@ class TestPost(api_base.FunctionalTest):
cluster_template = obj_utils.create_test_cluster_template(
self.context, name='foo', uuid='foo', master_lb_enabled=False)
bdict = apiutils.bay_post_data(baymodel_id=cluster_template.name,
master_count=3)
master_count=3, master_lb_enabled=False)
response = self.post_json('/bays', bdict, expect_errors=True)
self.assertEqual('application/json', response.content_type)
self.assertEqual(400, response.status_int)

3
magnum/tests/unit/api/controllers/v1/test_cluster.py

@ -845,7 +845,8 @@ class TestPost(api_base.FunctionalTest):
cluster_template = obj_utils.create_test_cluster_template(
self.context, name='foo', uuid='foo', master_lb_enabled=False)
bdict = apiutils.cluster_post_data(
cluster_template_id=cluster_template.name, master_count=3)
cluster_template_id=cluster_template.name, master_count=3,
master_lb_enabled=False)
response = self.post_json('/clusters', bdict, expect_errors=True)
self.assertEqual('application/json', response.content_type)
self.assertEqual(400, response.status_int)

2
magnum/tests/unit/db/utils.py

@ -101,7 +101,7 @@ def get_test_cluster(**kw):
'fixed_network': kw.get('fixed_network', None),
'fixed_subnet': kw.get('fixed_subnet', None),
'floating_ip_enabled': kw.get('floating_ip_enabled', True),
'master_lb_enabled': kw.get('master_lb_enabled', False),
'master_lb_enabled': kw.get('master_lb_enabled', True),
}
if kw.pop('for_api_use', False):

Loading…
Cancel
Save