summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Walker (Daviey) <DaveWalker@ubuntu.com>2011-07-17 22:49:22 +0100
committerDave Walker (Daviey) <DaveWalker@ubuntu.com>2011-07-17 22:49:22 +0100
commit718d4cf5cd4122bcecf0974c441d098f57a124b0 (patch)
tree63d97ae81c2a62962551aa1675ba66d6262ef240
parentcf25ab33cb7d6b5e233a767ad96b3c45b1387b5e (diff)
downloadnova-718d4cf5cd4122bcecf0974c441d098f57a124b0.tar.gz
nova-718d4cf5cd4122bcecf0974c441d098f57a124b0.tar.xz
nova-718d4cf5cd4122bcecf0974c441d098f57a124b0.zip
Initial test case proving we have a bug of, ec2 security group name can exceed 255 chars.
-rw-r--r--nova/tests/test_api.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/nova/tests/test_api.py b/nova/tests/test_api.py
index 20b20fcbf..63f040ffd 100644
--- a/nova/tests/test_api.py
+++ b/nova/tests/test_api.py
@@ -293,6 +293,26 @@ class ApiEc2TestCase(test.TestCase):
self.manager.delete_project(project)
self.manager.delete_user(user)
+ def test_group_name_valid_security_group(self):
+ """Test that we sanely handle invalid security group names. """
+ self.expect_http()
+ self.mox.ReplayAll()
+ user = self.manager.create_user('fake', 'fake', 'fake', admin=True)
+ project = self.manager.create_project('fake', 'fake', 'fake')
+
+ # At the moment, you need both of these to actually be netadmin
+ self.manager.add_role('fake', 'netadmin')
+ project.add_role('fake', 'netadmin')
+
+ security_group_name = "".join(random.choice("poiuytrewqasdfghjklmnbvc")
+ for x in range(random.randint(256, 266)))
+ try:
+ self.ec2.create_security_group(security_group_name, 'test group')
+ except:
+ pass
+ else:
+ self.fail('Exception not raised.')
+
def test_authorize_revoke_security_group_cidr(self):
"""
Test that we can add and remove CIDR based rules