blob: 77c3624496d3535a08ffea4a3863330c73fda180 [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
34 def launch_stack(self, template_name, expected_status='CREATE_COMPLETE',
35 parameters=None, **kwargs):
36 template = self._load_template(__file__, template_name, self.sub_dir)
37
38 parameters = parameters or {}
39
40 if kwargs.get('add_parameters'):
41 parameters.update(kwargs['add_parameters'])
42
43 stack_id = self.stack_create(
44 stack_name=kwargs.get('stack_name'),
45 template=template,
46 files=kwargs.get('files'),
47 parameters=parameters,
48 environment=kwargs.get('environment'),
49 expected_status=expected_status
50 )
51
52 return stack_id