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