blob: dd25b89dd799cf2037c2a8284afdaab10f38b59e [file] [log] [blame]
Anastasia Kuznetsovae45bfff2015-02-25 12:50:34 +04001# Licensed under the Apache License, Version 2.0 (the "License"); you may
2# not use this file except in compliance with the License. You may obtain
3# a copy of the License at
4#
5# http://www.apache.org/licenses/LICENSE-2.0
6#
7# Unless required by applicable law or agreed to in writing, software
8# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10# License for the specific language governing permissions and limitations
11# under the License.
12
13from heat_integrationtests.common import test
14
15
16class ScenarioTestsBase(test.HeatIntegrationTest):
17 "This class define common parameters for scenario tests"
18
19 def setUp(self):
20 super(ScenarioTestsBase, self).setUp()
21 self.client = self.orchestration_client
22 self.sub_dir = 'templates'
23 self.assign_keypair()
Anastasia Kuznetsova673fc432015-03-12 16:41:36 +040024
25 if not self.conf.fixed_network_name:
26 raise self.skipException("No default network configured to test")
27 self.net = self._get_network()
Anastasia Kuznetsovae45bfff2015-02-25 12:50:34 +040028
29 if not self.conf.image_ref:
30 raise self.skipException("No image configured to test")
31 if not self.conf.instance_type:
32 raise self.skipException("No flavor configured to test")
33
Pavlo Shchelokovskyy46e5cb22015-03-23 12:01:25 +000034 if not self.conf.minimal_image_ref:
35 raise self.skipException("No minimal image configured to test")
36 if not self.conf.minimal_instance_type:
37 raise self.skipException("No minimal flavor configured to test")
38
Anastasia Kuznetsovae45bfff2015-02-25 12:50:34 +040039 def launch_stack(self, template_name, expected_status='CREATE_COMPLETE',
40 parameters=None, **kwargs):
41 template = self._load_template(__file__, template_name, self.sub_dir)
42
43 parameters = parameters or {}
44
45 if kwargs.get('add_parameters'):
46 parameters.update(kwargs['add_parameters'])
47
48 stack_id = self.stack_create(
49 stack_name=kwargs.get('stack_name'),
50 template=template,
51 files=kwargs.get('files'),
52 parameters=parameters,
53 environment=kwargs.get('environment'),
54 expected_status=expected_status
55 )
56
57 return stack_id