Check the length of flavor name in "flavor-create"
Fixes bug 1102280 The length of flavor name is defined 255 charaters in database. But flavor name can be more than 255 characters when a flavor is created. This patch adds the length check of flavor name. Change-Id: If9db879e5f6340594b215b057a29d03c6fef1503
This commit is contained in:
@@ -142,6 +142,17 @@ class InstanceTypeTestCase(test.TestCase):
|
||||
self.assertRaises(exception.InvalidInput, instance_types.create,
|
||||
name, 256, 1, 120, 100, flavorid)
|
||||
|
||||
def test_instance_type_create_with_long_flavor_name(self):
|
||||
# Flavor name with 255 characters or less is valid.
|
||||
name = 'a' * 255
|
||||
inst_type = instance_types.create(name, 64, 1, 120, flavorid=11)
|
||||
self.assertEqual(inst_type['name'], name)
|
||||
|
||||
# Flavor name which is more than 255 characters will cause error.
|
||||
name = 'a' * 256
|
||||
self.assertRaises(exception.InvalidInput, instance_types.create,
|
||||
name, 64, 1, 120, flavorid=11)
|
||||
|
||||
def test_add_instance_type_access(self):
|
||||
user_id = 'fake'
|
||||
project_id = 'fake'
|
||||
|
Reference in New Issue
Block a user