diff options
author | Steven Hardy <shardy@redhat.com> | 2014-11-14 15:10:57 +0000 |
---|---|---|
committer | Steven Hardy <shardy@redhat.com> | 2014-11-19 21:14:58 +0000 |
commit | 1d6dc24f0dd55666bfa77dbc7c34c038d779082d (patch) | |
tree | c0277575b09d00c5903f8607eee6e05666850008 | |
parent | 699cc6251501638759177fe83b4090faeb88e0e5 (diff) | |
download | heat-1d6dc24f0dd55666bfa77dbc7c34c038d779082d.tar.gz |
RandomString don't skip superclass validation
Ensure the superclass validation happens as well as the class-local
additional stuff.
Change-Id: I3fdc6e5d6a4ca741cdd12ca0ed6ceb908c03ae9f
Closes-Bug: #1392754
(cherry picked from commit 02c4b2441e12ed12fa58ddd9858b5d91314668ee)
-rw-r--r-- | heat/engine/resources/random_string.py | 1 | ||||
-rw-r--r-- | heat/tests/test_random_string.py | 14 |
2 files changed, 15 insertions, 0 deletions
diff --git a/heat/engine/resources/random_string.py b/heat/engine/resources/random_string.py index 2ed5bc054..033ad9392 100644 --- a/heat/engine/resources/random_string.py +++ b/heat/engine/resources/random_string.py @@ -223,6 +223,7 @@ class RandomString(resource.Resource): return random_string def validate(self): + super(RandomString, self).validate() sequence = self.properties.get(self.SEQUENCE) char_sequences = self.properties.get(self.CHARACTER_SEQUENCES) char_classes = self.properties.get(self.CHARACTER_CLASSES) diff --git a/heat/tests/test_random_string.py b/heat/tests/test_random_string.py index 7c094c073..e86f59b81 100644 --- a/heat/tests/test_random_string.py +++ b/heat/tests/test_random_string.py @@ -194,6 +194,20 @@ Resources: "character class and character sequence minimums", six.text_type(exc)) + def test_exceeds_max_length(self): + template_random_string = ''' +HeatTemplateFormatVersion: '2012-12-12' +Resources: + secret: + Type: OS::Heat::RandomString + Properties: + length: 513 +''' + exc = self.assertRaises(exception.StackValidationFailed, + self.create_stack, template_random_string) + self.assertIn('length 513 is out of range (min: 1, max: 512)', + six.text_type(exc)) + class TestGenerateRandomString(HeatTestCase): |