blob: 4ff951d5b694d5fd36fff4aef012e788a79fbabf [file] [log] [blame]
Bartosz Górskiab33b7e2013-06-27 00:39:47 -07001# 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
Bartosz Górskiab33b7e2013-06-27 00:39:47 -070013from tempest.api.orchestration import base
Ken'ichi Ohmichi60680a82017-03-10 11:03:16 -080014from tempest.lib.common.utils import data_utils
Ken'ichi Ohmichi835a9452017-01-27 18:17:07 -080015from tempest.lib import decorators
Bartosz Górskiab33b7e2013-06-27 00:39:47 -070016
17
Bartosz Górskiab33b7e2013-06-27 00:39:47 -070018class TemplateYAMLTestJSON(base.BaseOrchestrationTest):
Bartosz Górskiab33b7e2013-06-27 00:39:47 -070019 template = """
20HeatTemplateFormatVersion: '2012-12-12'
21Description: |
22 Template which creates only a new user
23Resources:
24 CfnUser:
25 Type: AWS::IAM::User
26"""
27
Bartosz Górskiab33b7e2013-06-27 00:39:47 -070028 @classmethod
Andrea Frittoli556f7962014-09-15 13:14:54 +010029 def resource_setup(cls):
30 super(TemplateYAMLTestJSON, cls).resource_setup()
Masayuki Igawa259c1132013-10-31 17:48:44 +090031 cls.stack_name = data_utils.rand_name('heat')
Bartosz Górskiab33b7e2013-06-27 00:39:47 -070032 cls.stack_identifier = cls.create_stack(cls.stack_name, cls.template)
33 cls.client.wait_for_stack_status(cls.stack_identifier,
34 'CREATE_COMPLETE')
35 cls.stack_id = cls.stack_identifier.split('/')[1]
36 cls.parameters = {}
37
Ken'ichi Ohmichi835a9452017-01-27 18:17:07 -080038 @decorators.idempotent_id('47430699-c368-495e-a1db-64c26fd967d7')
Bartosz Górskiab33b7e2013-06-27 00:39:47 -070039 def test_show_template(self):
40 """Getting template used to create the stack."""
David Kranz8ad924b2015-01-16 16:50:18 -050041 self.client.show_template(self.stack_identifier)
Bartosz Górskiab33b7e2013-06-27 00:39:47 -070042
Ken'ichi Ohmichi835a9452017-01-27 18:17:07 -080043 @decorators.idempotent_id('ed53debe-8727-46c5-ab58-eba6090ec4de')
Bartosz Górskiab33b7e2013-06-27 00:39:47 -070044 def test_validate_template(self):
45 """Validating template passing it content."""
David Kranz8ad924b2015-01-16 16:50:18 -050046 self.client.validate_template(self.template,
47 self.parameters)
Bartosz Górskiab33b7e2013-06-27 00:39:47 -070048
Bartosz Górskiab33b7e2013-06-27 00:39:47 -070049
50class TemplateAWSTestJSON(TemplateYAMLTestJSON):
51 template = """
52{
53 "AWSTemplateFormatVersion" : "2010-09-09",
54 "Description" : "Template which creates only a new user",
55 "Resources" : {
56 "CfnUser" : {
57 "Type" : "AWS::IAM::User"
58 }
59 }
60}
61"""