summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorDan Smith <danms@us.ibm.com>2012-12-12 13:14:56 -0800
committerDan Smith <danms@us.ibm.com>2012-12-15 08:19:57 -0800
commit2f8ffcc46db933ba27e14835c4448320bee5daa0 (patch)
treeef9cbad5a37abddb5ad406434b51a9a8ca08a505 /nova/tests
parent20f0c601fe5bd59c2a2f07a8be428ddca995afc5 (diff)
Move agent_build_get_by_triple to conductor
This patch moves the final method in Compute's VirtAPI to using the conductor. Related to blueprint no-db-compute-manager Change-Id: Icaf8990e117c8de7198de2f26f0d77e56c129430
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/compute/test_virtapi.py29
-rw-r--r--nova/tests/conductor/test_conductor.py11
2 files changed, 14 insertions, 26 deletions
diff --git a/nova/tests/compute/test_virtapi.py b/nova/tests/compute/test_virtapi.py
index ceeacbc9d..568bf456d 100644
--- a/nova/tests/compute/test_virtapi.py
+++ b/nova/tests/compute/test_virtapi.py
@@ -129,33 +129,10 @@ class ComputeVirtAPITest(VirtAPIBaseTest):
self.compute = FakeCompute()
self.virtapi = compute_manager.ComputeVirtAPI(self.compute)
- def setUp(self):
- super(ComputeVirtAPITest, self).setUp()
- # NOTE(danms): Eventually these should all be migrated to the
- # conductor, but until then, dispatch appropriately.
- self.conductor_methods = ['instance_update', 'instance_get_by_uuid',
- 'instance_get_all_by_host',
- 'aggregate_get_by_host',
- 'aggregate_metadata_add',
- 'aggregate_metadata_delete',
- 'security_group_get_by_instance',
- 'security_group_rule_get_by_security_group',
- 'provider_fw_rule_get_all',
- ]
- self.db_methods = ['agent_build_get_by_triple',
- ]
-
def assertExpected(self, method, *args, **kwargs):
- if method in self.conductor_methods:
- target = self.compute.conductor_api
- elif method in self.db_methods:
- target = self.compute.db
- else:
- raise Exception('Method "%s" not known to this test!')
-
- self.mox.StubOutWithMock(target, method)
- getattr(target, method)(self.context, *args, **kwargs).AndReturn(
- 'it worked')
+ self.mox.StubOutWithMock(self.compute.conductor_api, method)
+ getattr(self.compute.conductor_api, method)(
+ self.context, *args, **kwargs).AndReturn('it worked')
self.mox.ReplayAll()
result = getattr(self.virtapi, method)(self.context, *args, **kwargs)
self.assertEqual(result, 'it worked')
diff --git a/nova/tests/conductor/test_conductor.py b/nova/tests/conductor/test_conductor.py
index 6acbe7ef6..734dba9ed 100644
--- a/nova/tests/conductor/test_conductor.py
+++ b/nova/tests/conductor/test_conductor.py
@@ -251,6 +251,17 @@ class _BaseTestCase(object):
result = self.conductor.provider_fw_rule_get_all(self.context)
self.assertEqual(result, fake_rules)
+ def test_agent_build_get_by_triple(self):
+ self.mox.StubOutWithMock(db, 'agent_build_get_by_triple')
+ db.agent_build_get_by_triple(self.context, 'fake-hv', 'fake-os',
+ 'fake-arch').AndReturn('it worked')
+ self.mox.ReplayAll()
+ result = self.conductor.agent_build_get_by_triple(self.context,
+ 'fake-hv',
+ 'fake-os',
+ 'fake-arch')
+ self.assertEqual(result, 'it worked')
+
class ConductorTestCase(_BaseTestCase, test.TestCase):
"""Conductor Manager Tests"""