summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2012-12-12 21:58:15 +0000
committerGerrit Code Review <review@openstack.org>2012-12-12 21:58:15 +0000
commitb2b2bfce72a60b6728cebb446d704544e7cd2599 (patch)
tree33758795f37d32aa3f77451c1d15d3232e6aa6db /nova/tests
parent4a4c6ded461cc18f3112896400d0585cfad22043 (diff)
parentf2df5304f1de961ea2c9e1f4101f201b7b99ff53 (diff)
Merge "Allow rpc-silent FloatingIP exceptions in n-net"
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/network/test_manager.py44
1 files changed, 44 insertions, 0 deletions
diff --git a/nova/tests/network/test_manager.py b/nova/tests/network/test_manager.py
index d17bce0d2..2338e6259 100644
--- a/nova/tests/network/test_manager.py
+++ b/nova/tests/network/test_manager.py
@@ -30,6 +30,7 @@ from nova.network import manager as network_manager
from nova.openstack.common import importutils
from nova.openstack.common import log as logging
from nova.openstack.common import rpc
+from nova.openstack.common.rpc import common as rpc_common
import nova.policy
from nova import test
from nova.tests import fake_ldap
@@ -1930,6 +1931,49 @@ class FloatingIPTestCase(test.TestCase):
self.network.add_virtual_interface(ctxt, 'fake_uuid', 'fake_net')
self.assertEqual(macs, [])
+ def test_deallocate_client_exceptions(self):
+ """Ensure that FloatingIpNotFoundForAddress is wrapped"""
+ self.mox.StubOutWithMock(self.network.db, 'floating_ip_get_by_address')
+ self.network.db.floating_ip_get_by_address(
+ self.context, '1.2.3.4').AndRaise(
+ exception.FloatingIpNotFoundForAddress)
+ self.mox.ReplayAll()
+ self.assertRaises(rpc_common.ClientException,
+ self.network.deallocate_floating_ip,
+ self.context, '1.2.3.4')
+
+ def test_associate_client_exceptions(self):
+ """Ensure that FloatingIpNotFoundForAddress is wrapped"""
+ self.mox.StubOutWithMock(self.network.db, 'floating_ip_get_by_address')
+ self.network.db.floating_ip_get_by_address(
+ self.context, '1.2.3.4').AndRaise(
+ exception.FloatingIpNotFoundForAddress)
+ self.mox.ReplayAll()
+ self.assertRaises(rpc_common.ClientException,
+ self.network.associate_floating_ip,
+ self.context, '1.2.3.4', '10.0.0.1')
+
+ def test_disassociate_client_exceptions(self):
+ """Ensure that FloatingIpNotFoundForAddress is wrapped"""
+ self.mox.StubOutWithMock(self.network.db, 'floating_ip_get_by_address')
+ self.network.db.floating_ip_get_by_address(
+ self.context, '1.2.3.4').AndRaise(
+ exception.FloatingIpNotFoundForAddress)
+ self.mox.ReplayAll()
+ self.assertRaises(rpc_common.ClientException,
+ self.network.disassociate_floating_ip,
+ self.context, '1.2.3.4')
+
+ def test_get_floating_ip_client_exceptions(self):
+ """Ensure that FloatingIpNotFoundForAddress is wrapped"""
+ self.mox.StubOutWithMock(self.network.db, 'floating_ip_get')
+ self.network.db.floating_ip_get(self.context, 'fake-id').AndRaise(
+ exception.FloatingIpNotFound)
+ self.mox.ReplayAll()
+ self.assertRaises(rpc_common.ClientException,
+ self.network.get_floating_ip,
+ self.context, 'fake-id')
+
class NetworkPolicyTestCase(test.TestCase):
def setUp(self):