summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorMonsyne Dragon <mdragon@rackspace.com>2012-07-27 19:51:32 +0000
committerMonsyne Dragon <mdragon@rackspace.com>2012-07-27 19:55:03 +0000
commitaad7743f42e559aefde37bb44622986df4e2ae98 (patch)
tree4ac6c94f882f8bf97b0f84d6f893fafd4bcedc65 /nova/tests
parentffaffa12984449aba1468c14f1580c13cd867acf (diff)
Correct host count in instance_usage_audit_log extension.
This fixes bug 1030106. Basically we were not counting disabled hosts in the total host count. Also I have refactored the get_audit_task_logs method, it's really part of the extension (only the extension uses it), so I've moved it out of nova.compute.utils into the extension itself. (the tests that exercise it already lived in the extension's tests anyway.) Change-Id: Iaf42d887b824ba0cbf6ab0ed143a4c01b37b0cb1
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/api/openstack/compute/contrib/test_instance_usage_audit_log.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/nova/tests/api/openstack/compute/contrib/test_instance_usage_audit_log.py b/nova/tests/api/openstack/compute/contrib/test_instance_usage_audit_log.py
index b81052ddc..2e06897c7 100644
--- a/nova/tests/api/openstack/compute/contrib/test_instance_usage_audit_log.py
+++ b/nova/tests/api/openstack/compute/contrib/test_instance_usage_audit_log.py
@@ -27,8 +27,12 @@ from nova.tests.api.openstack import fakes
from nova import utils
-TEST_COMPUTE_SERVICES = [dict(host=name) for name in
- "foo bar baz plonk".split()]
+TEST_COMPUTE_SERVICES = [dict(host='foo', topic='compute'),
+ dict(host='bar', topic='compute'),
+ dict(host='baz', topic='compute'),
+ dict(host='plonk', topic='compute'),
+ dict(host='wibble', topic='bogus'),
+ ]
begin1 = datetime.datetime(2012, 7, 4, 6, 0, 0)
@@ -79,8 +83,7 @@ TEST_LOGS3 = [
]
-def fake_service_get_all_by_topic(context, topic):
- assert topic == "compute"
+def fake_service_get_all(context):
return TEST_COMPUTE_SERVICES
@@ -117,8 +120,8 @@ class InstanceUsageAuditLogTest(test.TestCase):
self.stubs.Set(utils, 'last_completed_audit_period',
fake_last_completed_audit_period)
- self.stubs.Set(db, 'service_get_all_by_topic',
- fake_service_get_all_by_topic)
+ self.stubs.Set(db, 'service_get_all',
+ fake_service_get_all)
self.stubs.Set(db, 'task_log_get_all',
fake_task_log_get_all)