diff options
| author | Dan Smith <danms@us.ibm.com> | 2012-12-11 09:32:36 -0800 |
|---|---|---|
| committer | Dan Smith <danms@us.ibm.com> | 2012-12-11 09:32:36 -0800 |
| commit | f2df5304f1de961ea2c9e1f4101f201b7b99ff53 (patch) | |
| tree | ed4b26b5d2d71bb212811ff50f4810060afff990 /nova/tests | |
| parent | 405c67b1c0b8154dbaec8d6cc838bc32125ce634 (diff) | |
Allow rpc-silent FloatingIP exceptions in n-net
This patch uses the new client_exceptions functionality to squelch
some errant exception dumps in the RPC layer.
Fixes bug 1084707
Change-Id: I31a783a67d7722751fcfeafab40e781dc762dd65
Diffstat (limited to 'nova/tests')
| -rw-r--r-- | nova/tests/network/test_manager.py | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/nova/tests/network/test_manager.py b/nova/tests/network/test_manager.py index cab684767..1a0ef2d37 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 @@ -1929,6 +1930,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): |
