summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorDan Smith <danms@us.ibm.com>2013-06-17 13:43:15 -0700
committerDan Smith <danms@us.ibm.com>2013-06-19 13:34:49 -0700
commit2b36b2437f707614889a450f59b7b5bf02aa85a4 (patch)
treea048d63de44e2bd22f2df89c6a19c3b7e942464c /nova/tests
parent6bbe906db0385bcd11e0532b8b180272feb76042 (diff)
Use InstanceList for _heal_instance_info_cache()
This makes _heal_instance_info_cache() use InstanceList for the all-by-host query. Related to blueprint unified-object-model Change-Id: I93872a35ff249bbeb7d02bfe54a7d83676aa447a
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/compute/test_compute.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/nova/tests/compute/test_compute.py b/nova/tests/compute/test_compute.py
index 8c6fce3a5..fe3d3e21e 100644
--- a/nova/tests/compute/test_compute.py
+++ b/nova/tests/compute/test_compute.py
@@ -4333,9 +4333,11 @@ class ComputeTestCase(BaseTestCase):
instance_map = {}
instances = []
for x in xrange(5):
- uuid = 'fake-uuid-%s' % x
- instance_map[uuid] = {'uuid': uuid, 'host': CONF.host}
- instances.append(instance_map[uuid])
+ inst_uuid = 'fake-uuid-%s' % x
+ instance_map[inst_uuid] = fake_instance.fake_db_instance(
+ uuid=inst_uuid, host=CONF.host, created_at=None)
+ # These won't be in our instance since they're not requested
+ instances.append(instance_map[inst_uuid])
call_info = {'get_all_by_host': 0, 'get_by_uuid': 0,
'get_nw_info': 0, 'expected_instance': None}
@@ -4345,7 +4347,7 @@ class ComputeTestCase(BaseTestCase):
self.assertEqual(columns_to_join, [])
return instances[:]
- def fake_instance_get_by_uuid(context, instance_uuid):
+ def fake_instance_get_by_uuid(context, instance_uuid, columns_to_join):
if instance_uuid not in instance_map:
raise exception.InstanceNotFound(instance_id=instance_uuid)
call_info['get_by_uuid'] += 1
@@ -4357,12 +4359,13 @@ class ComputeTestCase(BaseTestCase):
# and is ignored. However, the below increment of
# 'get_nw_info' won't happen, and you'll get an assert
# failure checking it below.
- self.assertEqual(call_info['expected_instance'], instance)
+ self.assertEqual(call_info['expected_instance']['uuid'],
+ instance['uuid'])
call_info['get_nw_info'] += 1
- self.stubs.Set(self.compute.conductor_api, 'instance_get_all_by_host',
+ self.stubs.Set(db, 'instance_get_all_by_host',
fake_instance_get_all_by_host)
- self.stubs.Set(self.compute.conductor_api, 'instance_get_by_uuid',
+ self.stubs.Set(db, 'instance_get_by_uuid',
fake_instance_get_by_uuid)
self.stubs.Set(self.compute, '_get_instance_nw_info',
fake_get_instance_nw_info)