Clint Byrum | 71f2763 | 2013-09-09 11:41:32 -0700 | [diff] [blame] | 1 | # 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 | |
| 13 | import logging |
| 14 | |
| 15 | from tempest.api.orchestration import base |
Masayuki Igawa | 259c113 | 2013-10-31 17:48:44 +0900 | [diff] [blame] | 16 | from tempest.common.utils import data_utils |
Matthew Treinish | cb09bbb | 2014-01-29 18:20:25 +0000 | [diff] [blame] | 17 | from tempest import config |
Clint Byrum | 71f2763 | 2013-09-09 11:41:32 -0700 | [diff] [blame] | 18 | from tempest import exceptions |
| 19 | from tempest.test import attr |
| 20 | |
Matthew Treinish | cb09bbb | 2014-01-29 18:20:25 +0000 | [diff] [blame] | 21 | CONF = config.CONF |
Clint Byrum | 71f2763 | 2013-09-09 11:41:32 -0700 | [diff] [blame] | 22 | |
| 23 | LOG = logging.getLogger(__name__) |
| 24 | |
| 25 | |
| 26 | class TestServerStackLimits(base.BaseOrchestrationTest): |
Clint Byrum | 71f2763 | 2013-09-09 11:41:32 -0700 | [diff] [blame] | 27 | |
| 28 | @attr(type='gate') |
| 29 | def test_exceed_max_template_size_fails(self): |
Sean Dague | ad82491 | 2014-03-25 14:56:35 -0400 | [diff] [blame] | 30 | stack_name = data_utils.rand_name('heat') |
Matthew Treinish | cb09bbb | 2014-01-29 18:20:25 +0000 | [diff] [blame] | 31 | fill = 'A' * CONF.orchestration.max_template_size |
Clint Byrum | 71f2763 | 2013-09-09 11:41:32 -0700 | [diff] [blame] | 32 | template = ''' |
| 33 | HeatTemplateFormatVersion: '2012-12-12' |
| 34 | Description: '%s' |
| 35 | Outputs: |
| 36 | Foo: bar''' % fill |
| 37 | ex = self.assertRaises(exceptions.BadRequest, self.create_stack, |
Sean Dague | ad82491 | 2014-03-25 14:56:35 -0400 | [diff] [blame] | 38 | stack_name, template) |
Clint Byrum | 71f2763 | 2013-09-09 11:41:32 -0700 | [diff] [blame] | 39 | self.assertIn('Template exceeds maximum allowed size', str(ex)) |