summaryrefslogtreecommitdiffstats
path: root/smoketests
diff options
context:
space:
mode:
authorRussell Bryant <rbryant@redhat.com>2012-02-10 19:01:10 -0500
committerRussell Bryant <rbryant@redhat.com>2012-02-14 17:20:53 -0500
commit3dc539bcb0d9031f81076ac2e1870918400150ed (patch)
treedb1d203bd9063a8c7ad74e9d5d178094704801bf /smoketests
parent028c62f378d06ffbae8f698611e1d1ce80f1ede2 (diff)
downloadnova-3dc539bcb0d9031f81076ac2e1870918400150ed.tar.gz
nova-3dc539bcb0d9031f81076ac2e1870918400150ed.tar.xz
nova-3dc539bcb0d9031f81076ac2e1870918400150ed.zip
Don't allow EC2 removal of security group in use.
Fix bug 817872. This patch modifies the behavior of removing security groups via the EC2 API to better match the EC2 API spec. The EC2 documentation says that a group that is still in use can not be removed. A new function has been added to the db API to find out whether a particular security group is still in use. "In use" is defined as applied to an active instance, or applied to another group that has not been deleted. Unit tests have been updated to ensure that an error is raised when these conditions are hit. Change-Id: I5b3fdf1da213b04084fe266c1a6ed92e01cf1e19
Diffstat (limited to 'smoketests')
-rw-r--r--smoketests/base.py10
-rw-r--r--smoketests/test_netadmin.py3
2 files changed, 12 insertions, 1 deletions
diff --git a/smoketests/base.py b/smoketests/base.py
index 31d82b20b..db28b6f5a 100644
--- a/smoketests/base.py
+++ b/smoketests/base.py
@@ -72,6 +72,16 @@ class SmokeTestCase(unittest.TestCase):
else:
return False
+ def wait_for_not_running(self, instance, tries=60, wait=1):
+ """Wait for instance to not be running"""
+ for x in xrange(tries):
+ instance.update()
+ if not instance.state.startswith('running'):
+ return True
+ time.sleep(wait)
+ else:
+ return False
+
def wait_for_ping(self, ip, command="ping", tries=120):
"""Wait for ip to be pingable"""
for x in xrange(tries):
diff --git a/smoketests/test_netadmin.py b/smoketests/test_netadmin.py
index d097d232a..6a0dc48ec 100644
--- a/smoketests/test_netadmin.py
+++ b/smoketests/test_netadmin.py
@@ -195,8 +195,9 @@ class SecurityGroupTests(base.UserSmokeTestCase):
def test_999_tearDown(self):
self.conn.disassociate_address(self.data['public_ip'])
self.conn.delete_key_pair(TEST_KEY)
+ self.conn.terminate_instances([self.data['instance'].id])
+ self.wait_for_not_running(self.data['instance'])
self.conn.delete_security_group(TEST_GROUP)
groups = self.conn.get_all_security_groups()
self.assertFalse(TEST_GROUP in [group.name for group in groups])
- self.conn.terminate_instances([self.data['instance'].id])
self.assertTrue(self.conn.release_address(self.data['public_ip']))