diff options
| author | Jenkins <jenkins@review.openstack.org> | 2011-10-27 14:51:34 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2011-10-27 14:51:34 +0000 |
| commit | 6c039120f54e4d8fa99f9e09148879de4dc04bb2 (patch) | |
| tree | 773d4f2a3cb8e72f210f7786a4841eb297108ea4 /nova/tests | |
| parent | 1b7fba648aa3eb4cdda345237c9f77dc0b229329 (diff) | |
| parent | 636c70c3c990d0405c7e05a428d78908dc8b4317 (diff) | |
Merge "Fix deletion of instances without fixed ips."
Diffstat (limited to 'nova/tests')
| -rw-r--r-- | nova/tests/test_network.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/nova/tests/test_network.py b/nova/tests/test_network.py index e3d27e091..17e79f39a 100644 --- a/nova/tests/test_network.py +++ b/nova/tests/test_network.py @@ -972,3 +972,30 @@ class CommonNetworkTestCase(test.TestCase): self.assertTrue(res) self.assertEqual(len(res), 1) self.assertEqual(res[0]['instance_id'], _vifs[2]['instance_id']) + + +class TestFloatingIPManager(network_manager.FloatingIP, + network_manager.NetworkManager): + """Dummy manager that implements FloatingIP""" + + +class FloatingIPTestCase(test.TestCase): + """Tests nova.network.manager.FloatingIP""" + def setUp(self): + super(FloatingIPTestCase, self).setUp() + self.network = TestFloatingIPManager() + self.network.db = db + self.project_id = 'testproject' + self.context = context.RequestContext('testuser', self.project_id, + is_admin=False) + + def test_double_deallocation(self): + instance_ref = db.api.instance_create(self.context, + {"project_id": self.project_id}) + # Run it twice to make it fault if it does not handle + # instances without fixed networks + # If this fails in either, it does not handle having no addresses + self.network.deallocate_for_instance(self.context, + instance_id=instance_ref['id']) + self.network.deallocate_for_instance(self.context, + instance_id=instance_ref['id']) |
