Merge "scenario tests: allow to use boot_from_volume on NGT"
This commit is contained in:
commit
994b21aacd
|
@ -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(
|
self.neutron.add_security_group_rule_for_neutron(
|
||||||
security_group)
|
security_group)
|
||||||
kwargs['security_groups'] = [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 = self.__create_node_group_template(**kwargs)
|
||||||
ng_id_map[ng['name']] = ng_id
|
ng_id_map[ng['name']] = ng_id
|
||||||
return ng_id_map
|
return ng_id_map
|
||||||
|
|
|
@ -206,6 +206,9 @@ SCHEMA = {
|
||||||
"minLength": 1
|
"minLength": 1
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"boot_from_volume": {
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
"auto_security_group": {
|
"auto_security_group": {
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
|
|
|
@ -218,6 +218,16 @@ class TestBase(testtools.TestCase):
|
||||||
self.assertEqual({'worker': 'id_ng', 'master': 'id_ng'},
|
self.assertEqual({'worker': 'id_ng', 'master': 'id_ng'},
|
||||||
self.base_scenario._create_node_group_templates())
|
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.'
|
@mock.patch('saharaclient.api.node_group_templates.'
|
||||||
'NodeGroupTemplateManager.create',
|
'NodeGroupTemplateManager.create',
|
||||||
return_value=FakeResponse(set_id='id_ng'))
|
return_value=FakeResponse(set_id='id_ng'))
|
||||||
|
|
Loading…
Reference in New Issue