From 6ff32210772a67a1b526d9d784030afc90f3ce99 Mon Sep 17 00:00:00 2001 From: Joe Gordon Date: Tue, 5 Feb 2013 18:12:02 -0800 Subject: Use joined version of db.api calls Replace db.instance_get_active_by_window with db.instance_get_active_by_window_joined Remove db.instance_get_active_by_window as it is now unused When moving over to nova.db.api not returning sqlalchemy objects non-joined db calls (lazy loaded) won't work. Partially implements bp db-api-cleanup Change-Id: Iec647792a049d53862a45f95accd7f46e483aa17 --- .../api/openstack/compute/contrib/test_simple_tenant_usage.py | 5 +++-- nova/tests/conductor/test_conductor.py | 10 ---------- 2 files changed, 3 insertions(+), 12 deletions(-) (limited to 'nova/tests') diff --git a/nova/tests/api/openstack/compute/contrib/test_simple_tenant_usage.py b/nova/tests/api/openstack/compute/contrib/test_simple_tenant_usage.py index 13a4e9d61..440c97fbd 100644 --- a/nova/tests/api/openstack/compute/contrib/test_simple_tenant_usage.py +++ b/nova/tests/api/openstack/compute/contrib/test_simple_tenant_usage.py @@ -65,7 +65,8 @@ def get_fake_db_instance(start, end, instance_id, tenant_id): 'terminated_at': end} -def fake_instance_get_active_by_window(self, context, begin, end, project_id): +def fake_instance_get_active_by_window_joined(self, context, begin, end, + project_id): return [get_fake_db_instance(START, STOP, x, @@ -79,7 +80,7 @@ class SimpleTenantUsageTest(test.TestCase): self.stubs.Set(api.API, "get_instance_type", fake_instance_type_get) self.stubs.Set(api.API, "get_active_by_window", - fake_instance_get_active_by_window) + fake_instance_get_active_by_window_joined) self.admin_context = context.RequestContext('fakeadmin_0', 'faketenant_0', is_admin=True) diff --git a/nova/tests/conductor/test_conductor.py b/nova/tests/conductor/test_conductor.py index 773b65d43..d4d0fc3bb 100644 --- a/nova/tests/conductor/test_conductor.py +++ b/nova/tests/conductor/test_conductor.py @@ -335,16 +335,6 @@ class _BaseTestCase(object): self.mox.ReplayAll() self.conductor.instance_get_all_hung_in_rebooting(self.context, 123) - def test_instance_get_active_by_window(self): - self.mox.StubOutWithMock(db, 'instance_get_active_by_window_joined') - db.instance_get_active_by_window(self.context, 'fake-begin', - 'fake-end', 'fake-proj', - 'fake-host') - self.mox.ReplayAll() - self.conductor.instance_get_active_by_window(self.context, - 'fake-begin', 'fake-end', - 'fake-proj', 'fake-host') - def test_instance_get_active_by_window_joined(self): self.mox.StubOutWithMock(db, 'instance_get_active_by_window_joined') db.instance_get_active_by_window_joined(self.context, 'fake-begin', -- cgit