Merge "scenario tests: allow to use boot_from_volume on NGT"

This commit is contained in:
Zuul 2019-06-27 18:45:34 +00:00 committed by Gerrit Code Review
commit 994b21aacd
4 changed files with 24 additions and 0 deletions

View File

@ -0,0 +1,5 @@
---
features:
- |
Allow to enable boot_from_volume on node group templates
when running scenario tests with APIv2.

View File

@ -601,6 +601,12 @@ class BaseTestCase(base.BaseTestCase):
self.neutron.add_security_group_rule_for_neutron(
security_group)
kwargs['security_groups'] = [security_group]
# boot_from_volume requires APIv2
if kwargs.get('boot_from_volume', False) and not self.use_api_v2:
raise Exception('boot_from_volume is set for %s but it '
'requires APIv2' % (kwargs['name']))
ng_id = self.__create_node_group_template(**kwargs)
ng_id_map[ng['name']] = ng_id
return ng_id_map

View File

@ -206,6 +206,9 @@ SCHEMA = {
"minLength": 1
}
},
"boot_from_volume": {
"type": "boolean"
},
"auto_security_group": {
"type": "boolean"
},

View File

@ -218,6 +218,16 @@ class TestBase(testtools.TestCase):
self.assertEqual({'worker': 'id_ng', 'master': 'id_ng'},
self.base_scenario._create_node_group_templates())
@mock.patch('neutronclient.v2_0.client.Client.list_networks',
return_value={'networks': [{'id': '2314'}]})
def test__create_node_group_template_bootfromvolume_apiv1(self, mock_del):
self.base_scenario._init_clients()
self.base_scenario.use_api_v2 = False
for ng in self.base_scenario.testcase['node_group_templates']:
ng['boot_from_volume'] = True
with self.assertRaisesRegex(Exception, "^boot_from_volume is.*"):
self.base_scenario._create_node_group_templates()
@mock.patch('saharaclient.api.node_group_templates.'
'NodeGroupTemplateManager.create',
return_value=FakeResponse(set_id='id_ng'))