summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorRussell Bryant <rbryant@redhat.com>2013-01-11 11:56:09 -0500
committerRussell Bryant <rbryant@redhat.com>2013-01-11 18:06:54 -0500
commit42f3d0bdbda3c54c0d3490e0f407e7dbb8f574ca (patch)
treec5a05b4050bc47ec94fed6965ecef44dd399525a /nova/tests
parent6ea308295a158b4700f4081913f66596fc769b36 (diff)
Make pinging conductor a part of conductor API.
This patch moves the loop that pings the conductor over rpc until it responds to be a part of the conductor API. This will allow it to be used elsewhere in the code as needed. Part of bp no-db-compute. Change-Id: Ie027adef4a3af3059b4ab586e927c93ae1a86fe9
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/compute/test_compute.py15
-rw-r--r--nova/tests/conductor/test_conductor.py21
2 files changed, 21 insertions, 15 deletions
diff --git a/nova/tests/compute/test_compute.py b/nova/tests/compute/test_compute.py
index bf619bbec..23df703be 100644
--- a/nova/tests/compute/test_compute.py
+++ b/nova/tests/compute/test_compute.py
@@ -3121,21 +3121,6 @@ class ComputeTestCase(BaseTestCase):
instance = self._create_fake_instance(params)
self.compute._instance_update(self.context, instance['uuid'])
- def test_startup_conductor_ping(self):
- timeouts = []
- calls = dict(count=0)
-
- def fake_ping(context, message, timeout):
- timeouts.append(timeout)
- calls['count'] += 1
- if calls['count'] < 15:
- raise rpc_common.Timeout("fake")
-
- self.stubs.Set(self.compute.conductor_api, 'ping', fake_ping)
- self.compute._get_instances_at_startup(self.context)
- self.assertEqual(timeouts.count(10), 10)
- self.assertTrue(None in timeouts)
-
def test_destroy_evacuated_instances(self):
fake_context = context.get_admin_context()
diff --git a/nova/tests/conductor/test_conductor.py b/nova/tests/conductor/test_conductor.py
index ffe09c95e..7986fc583 100644
--- a/nova/tests/conductor/test_conductor.py
+++ b/nova/tests/conductor/test_conductor.py
@@ -650,6 +650,23 @@ class ConductorAPITestCase(_BaseTestCase, test.TestCase):
def test_service_get_all_compute_by_host(self):
self._test_stubbed('service_get_all_compute_by_host', 'host')
+ def test_ping(self):
+ timeouts = []
+ calls = dict(count=0)
+
+ def fake_ping(_self, context, message, timeout):
+ timeouts.append(timeout)
+ calls['count'] += 1
+ if calls['count'] < 15:
+ raise rpc_common.Timeout("fake")
+
+ self.stubs.Set(conductor_api.API, 'ping', fake_ping)
+
+ self.conductor.wait_until_ready(self.context)
+
+ self.assertEqual(timeouts.count(10), 10)
+ self.assertTrue(None in timeouts)
+
class ConductorLocalAPITestCase(ConductorAPITestCase):
"""Conductor LocalAPI Tests."""
@@ -667,6 +684,10 @@ class ConductorLocalAPITestCase(ConductorAPITestCase):
self.assertRaises(KeyError,
self._do_update, instance['uuid'], foo='bar')
+ def test_ping(self):
+ # Override test in ConductorAPITestCase
+ pass
+
class ConductorImportTest(test.TestCase):
def test_import_conductor_local(self):