blob: 1111ea81925e522ad2acacb83a58707bb29b7f5e [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
Sergey Kraynevdaffd852015-06-22 09:49:47 -040041 network:
42 type: string
Steven Hardy7c1f2242015-01-12 16:32:56 +000043resources:
44 config:
45 type: My::Config
46 properties:
47 server: {get_resource: server}
48
49 server:
50 type: OS::Nova::Server
51 properties:
52 image: {get_param: image}
53 flavor: {get_param: flavor}
54 key_name: {get_param: keyname}
Sergey Kraynevdaffd852015-06-22 09:49:47 -040055 networks: [{network: {get_param: network} }]
Steven Hardy7c1f2242015-01-12 16:32:56 +000056 user_data_format: SOFTWARE_CONFIG
Sergey Kraynevdaffd852015-06-22 09:49:47 -040057
Steven Hardy7c1f2242015-01-12 16:32:56 +000058'''
59 config_template = '''
60heat_template_version: 2014-10-16
61parameters:
62 server:
63 type: string
64resources:
65 config:
66 type: OS::Heat::SoftwareConfig
67
68 deployment:
69 type: OS::Heat::SoftwareDeployment
70 properties:
71 config:
72 get_resource: config
73 server:
74 get_param: server
75'''
76 files = {'provider.yaml': config_template}
77 env = {'resource_registry':
78 {'My::Config': 'provider.yaml'}}
79 parameters = {'keyname': self.keypair_name,
Pavlo Shchelokovskyy46e5cb22015-03-23 12:01:25 +000080 'flavor': self.conf.minimal_instance_type,
Sergey Kraynevdaffd852015-06-22 09:49:47 -040081 'image': self.conf.minimal_image_ref,
82 'network': self.conf.fixed_network_name}
Steven Hardy7c1f2242015-01-12 16:32:56 +000083 # Note we don't wait for CREATE_COMPLETE, because we're using a
84 # minimal image without the tools to apply the config.
85 # The point of the test is just to prove that validation won't
86 # falsely prevent stack creation starting, ref bug #1407100
87 # Note that we can be sure My::Config will stay IN_PROGRESS as
88 # there's no signal sent to the deployment
89 self.stack_create(template=template,
90 files=files,
91 environment=env,
92 parameters=parameters,
93 expected_status='CREATE_IN_PROGRESS')