scenario tests: allow to use boot_from_volume on NGT
The key boot_from_volume can now be configured when defining node group templates. Thi change works only when API v2 is enabled. Change-Id: I1b23c2e457ceb6cf396addd5daa6d7bd36989167
This commit is contained in:
parent
f7c861806a
commit
4ed9f32b3c
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
features:
|
||||
- |
|
||||
Allow to enable boot_from_volume on node group templates
|
||||
when running scenario tests with APIv2.
|
|
@ -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
|
||||
|
|
|
@ -206,6 +206,9 @@ SCHEMA = {
|
|||
"minLength": 1
|
||||
}
|
||||
},
|
||||
"boot_from_volume": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"auto_security_group": {
|
||||
"type": "boolean"
|
||||
},
|
||||
|
|
|
@ -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'))
|
||||
|
|
Loading…
Reference in New Issue