blob: 6a65091bf8db51ade4fa9dc488017be1bf7ee1b5 [file] [log] [blame]
Steven Hardy7c1f2242015-01-12 16:32:56 +00001# 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
Steven Hardy7c1f2242015-01-12 16:32:56 +000013
14from heat_integrationtests.common import test
15
16
Steven Hardy7c1f2242015-01-12 16:32:56 +000017class StackValidationTest(test.HeatIntegrationTest):
18
19 def setUp(self):
20 super(StackValidationTest, self).setUp()
21 self.client = self.orchestration_client
22 if not self.conf.minimal_image_ref:
23 raise self.skipException("No image configured to test")
24
Pavlo Shchelokovskyy46e5cb22015-03-23 12:01:25 +000025 if not self.conf.minimal_instance_type:
26 raise self.skipException(
27 "No minimal_instance_type configured to test")
Steven Hardy7c1f2242015-01-12 16:32:56 +000028
Sergey Krayneva265c132015-02-13 03:51:03 -050029 self.assign_keypair()
Steven Hardy7c1f2242015-01-12 16:32:56 +000030
31 def test_stack_validate_provider_references_parent_resource(self):
32 template = '''
33heat_template_version: 2014-10-16
34parameters:
35 keyname:
36 type: string
37 flavor:
38 type: string
39 image:
40 type: string
41resources:
42 config:
43 type: My::Config
44 properties:
45 server: {get_resource: server}
46
47 server:
48 type: OS::Nova::Server
49 properties:
50 image: {get_param: image}
51 flavor: {get_param: flavor}
52 key_name: {get_param: keyname}
53 user_data_format: SOFTWARE_CONFIG
54'''
55 config_template = '''
56heat_template_version: 2014-10-16
57parameters:
58 server:
59 type: string
60resources:
61 config:
62 type: OS::Heat::SoftwareConfig
63
64 deployment:
65 type: OS::Heat::SoftwareDeployment
66 properties:
67 config:
68 get_resource: config
69 server:
70 get_param: server
71'''
72 files = {'provider.yaml': config_template}
73 env = {'resource_registry':
74 {'My::Config': 'provider.yaml'}}
75 parameters = {'keyname': self.keypair_name,
Pavlo Shchelokovskyy46e5cb22015-03-23 12:01:25 +000076 'flavor': self.conf.minimal_instance_type,
Steven Hardy7c1f2242015-01-12 16:32:56 +000077 'image': self.conf.minimal_image_ref}
78 # Note we don't wait for CREATE_COMPLETE, because we're using a
79 # minimal image without the tools to apply the config.
80 # The point of the test is just to prove that validation won't
81 # falsely prevent stack creation starting, ref bug #1407100
82 # Note that we can be sure My::Config will stay IN_PROGRESS as
83 # there's no signal sent to the deployment
84 self.stack_create(template=template,
85 files=files,
86 environment=env,
87 parameters=parameters,
88 expected_status='CREATE_IN_PROGRESS')