summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2013-01-04 12:56:35 +0000
committerGerrit Code Review <review@openstack.org>2013-01-04 12:56:35 +0000
commitbe22c7fb23448980a2ed1e8dee28abb376e89faf (patch)
treee537f8288426bf0a186252cb0b9266c347722458 /nova/tests
parentb4d72616c19d7b079f3225a3f57fe49e5df642f4 (diff)
parent881a93473c32a7c7e23a8e6dcede8394053408c6 (diff)
Merge "Eliminate race conditions in floating association"
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/network/test_manager.py2
-rw-r--r--nova/tests/test_db_api.py15
2 files changed, 16 insertions, 1 deletions
diff --git a/nova/tests/network/test_manager.py b/nova/tests/network/test_manager.py
index e80ea3936..eb3dcf14a 100644
--- a/nova/tests/network/test_manager.py
+++ b/nova/tests/network/test_manager.py
@@ -669,7 +669,7 @@ class VlanNetworkTestCase(test.TestCase):
is_admin=False)
def fake1(*args, **kwargs):
- pass
+ return '10.0.0.1'
# floating ip that's already associated
def fake2(*args, **kwargs):
diff --git a/nova/tests/test_db_api.py b/nova/tests/test_db_api.py
index ea6e9aea5..af329daf6 100644
--- a/nova/tests/test_db_api.py
+++ b/nova/tests/test_db_api.py
@@ -246,6 +246,21 @@ class DbApiTestCase(test.TestCase):
self.assertEqual(0, len(results))
db.instance_update(ctxt, instance['uuid'], {"task_state": None})
+ def test_multi_associate_disassociate(self):
+ ctxt = context.get_admin_context()
+ values = {'address': 'floating'}
+ floating = db.floating_ip_create(ctxt, values)
+ values = {'address': 'fixed'}
+ fixed = db.fixed_ip_create(ctxt, values)
+ res = db.floating_ip_fixed_ip_associate(ctxt, floating, fixed, 'foo')
+ self.assertEqual(res, fixed)
+ res = db.floating_ip_fixed_ip_associate(ctxt, floating, fixed, 'foo')
+ self.assertEqual(res, None)
+ res = db.floating_ip_disassociate(ctxt, floating)
+ self.assertEqual(res, fixed)
+ res = db.floating_ip_disassociate(ctxt, floating)
+ self.assertEqual(res, None)
+
def test_network_create_safe(self):
ctxt = context.get_admin_context()
values = {'host': 'localhost', 'project_id': 'project1'}