summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorJohn Tran <jtran@attinteractive.com>2011-06-11 01:31:10 +0000
committerTarmac <>2011-06-11 01:31:10 +0000
commit91e34d37d2907295e892e96ca2c3039c7fbe14bf (patch)
tree0dfe08c722b60f4050762cff9f075ccf61d81f6b /nova/tests
parent8e6fabd481520b46b47d2f9f9a9c9dfa200f5866 (diff)
parent05fecdf873a5c02dcb13c841304df872411d4183 (diff)
ec2 api method allocate_address ; raises exception.NoFloatingIpsDefined instead of UnknownError when there aren't any floating ips available.
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/test_cloud.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/nova/tests/test_cloud.py b/nova/tests/test_cloud.py
index ba133c860..13046f861 100644
--- a/nova/tests/test_cloud.py
+++ b/nova/tests/test_cloud.py
@@ -115,6 +115,18 @@ class CloudTestCase(test.TestCase):
public_ip=address)
db.floating_ip_destroy(self.context, address)
+ def test_allocate_address(self):
+ address = "10.10.10.10"
+ allocate = self.cloud.allocate_address
+ db.floating_ip_create(self.context,
+ {'address': address,
+ 'host': self.network.host})
+ self.assertEqual(allocate(self.context)['publicIp'], address)
+ db.floating_ip_destroy(self.context, address)
+ self.assertRaises(exception.NoMoreFloatingIps,
+ allocate,
+ self.context)
+
def test_associate_disassociate_address(self):
"""Verifies associate runs cleanly without raising an exception"""
address = "10.10.10.10"