diff --git a/ceilometer/alarm/evaluator/__init__.py b/ceilometer/alarm/evaluator/__init__.py index 59cf616e5..8f0abd414 100644 --- a/ceilometer/alarm/evaluator/__init__.py +++ b/ceilometer/alarm/evaluator/__init__.py @@ -35,6 +35,8 @@ UNKNOWN = 'insufficient data' OK = 'ok' ALARM = 'alarm' +cfg.CONF.import_group('service_credentials', 'ceilometer.service') + @six.add_metaclass(abc.ABCMeta) class Evaluator(object): diff --git a/ceilometer/alarm/service.py b/ceilometer/alarm/service.py index 5016eebe6..9bc989676 100644 --- a/ceilometer/alarm/service.py +++ b/ceilometer/alarm/service.py @@ -132,9 +132,6 @@ class SingletonAlarmService(AlarmService, os_service.Service): 'value': True}]) -cfg.CONF.import_opt('host', 'ceilometer.service') - - class PartitionedAlarmService(AlarmService, os_service.Service): def __init__(self): diff --git a/ceilometer/messaging.py b/ceilometer/messaging.py index 14d842ef0..6d40871bd 100644 --- a/ceilometer/messaging.py +++ b/ceilometer/messaging.py @@ -96,6 +96,7 @@ def cleanup(): def get_rpc_server(transport, topic, endpoint): """Return a configured oslo.messaging rpc server.""" + cfg.CONF.import_opt('host', 'ceilometer.service') target = oslo.messaging.Target(server=cfg.CONF.host, topic=topic) serializer = RequestContextSerializer(JsonPayloadSerializer()) return oslo.messaging.get_rpc_server(transport, target, diff --git a/ceilometer/tests/alarm/partition/test_coordination.py b/ceilometer/tests/alarm/partition/test_coordination.py index d1f8dcfb6..70dbb8e39 100644 --- a/ceilometer/tests/alarm/partition/test_coordination.py +++ b/ceilometer/tests/alarm/partition/test_coordination.py @@ -55,6 +55,9 @@ class TestCoordinate(tests_base.BaseTestCase): self.setup_messaging(self.CONF) self.test_interval = 120 + self.CONF.import_opt('evaluation_interval', + 'ceilometer.alarm.service', + group='alarm') self.CONF.set_override('evaluation_interval', self.test_interval, group='alarm') diff --git a/ceilometer/tests/api/__init__.py b/ceilometer/tests/api/__init__.py index 4fcc3a08a..566a5711a 100644 --- a/ceilometer/tests/api/__init__.py +++ b/ceilometer/tests/api/__init__.py @@ -26,6 +26,7 @@ from ceilometer.tests import db as db_test_base OPT_GROUP_NAME = 'keystone_authtoken' cfg.CONF.import_group(OPT_GROUP_NAME, "keystoneclient.middleware.auth_token") +cfg.CONF.import_opt("policy_file", "ceilometer.openstack.common.policy") class FunctionalTest(db_test_base.TestBase): diff --git a/ceilometer/tests/api/v2/test_complex_query.py b/ceilometer/tests/api/v2/test_complex_query.py index d7d2af6f1..9bb2bc6e4 100644 --- a/ceilometer/tests/api/v2/test_complex_query.py +++ b/ceilometer/tests/api/v2/test_complex_query.py @@ -17,6 +17,7 @@ # under the License. """Test the methods related to complex query.""" import datetime + import fixtures import jsonschema import mock @@ -25,7 +26,7 @@ import wsme from ceilometer.alarm.storage import models as alarm_models from ceilometer.api.controllers import v2 as api from ceilometer.openstack.common import test -from ceilometer import storage +from ceilometer.storage import models class FakeComplexQuery(api.ValidatedComplexQuery): @@ -49,7 +50,7 @@ class TestComplexQuery(test.BaseTestCase): super(TestComplexQuery, self).setUp() self.useFixture(fixtures.MonkeyPatch( 'pecan.response', mock.MagicMock())) - self.query = FakeComplexQuery(storage.models.Sample, + self.query = FakeComplexQuery(models.Sample, sample_name_mapping, True) self.query_alarm = FakeComplexQuery(alarm_models.Alarm) @@ -235,7 +236,7 @@ class TestComplexQuery(test.BaseTestCase): class TestFilterSyntaxValidation(test.BaseTestCase): def setUp(self): super(TestFilterSyntaxValidation, self).setUp() - self.query = FakeComplexQuery(storage.models.Sample, + self.query = FakeComplexQuery(models.Sample, sample_name_mapping, True) diff --git a/ceilometer/tests/base.py b/ceilometer/tests/base.py index 3914788f3..c0e6cb772 100644 --- a/ceilometer/tests/base.py +++ b/ceilometer/tests/base.py @@ -23,6 +23,7 @@ import six import eventlet import oslo.messaging +import oslo.messaging.conffixture from testtools import testcase from ceilometer import messaging diff --git a/ceilometer/tests/test_collector.py b/ceilometer/tests/test_collector.py index 78e05f130..3dd5571d0 100644 --- a/ceilometer/tests/test_collector.py +++ b/ceilometer/tests/test_collector.py @@ -43,6 +43,9 @@ class TestCollector(tests_base.BaseTestCase): def setUp(self): super(TestCollector, self).setUp() self.CONF = self.useFixture(config.Config()).conf + self.CONF.import_opt("connection", + "ceilometer.openstack.common.db.options", + group="database") self.CONF.set_override("connection", "log://", group='database') self.CONF.set_override('metering_secret', 'not-so-secret', group='publisher') diff --git a/ceilometer/tests/test_middleware.py b/ceilometer/tests/test_middleware.py index 10d6e4bfa..280f9a412 100644 --- a/ceilometer/tests/test_middleware.py +++ b/ceilometer/tests/test_middleware.py @@ -19,7 +19,7 @@ import mock from ceilometer import middleware from ceilometer.openstack.common.fixture import config -from ceilometer.openstack.common import test +from ceilometer.tests import base HTTP_REQUEST = { @@ -68,11 +68,12 @@ HTTP_RESPONSE = { } -class TestNotifications(test.BaseTestCase): +class TestNotifications(base.BaseTestCase): def setUp(self): super(TestNotifications, self).setUp() self.CONF = self.useFixture(config.Config()).conf + self.setup_messaging(self.CONF) def test_process_request_notification(self): sample = list(middleware.HTTPRequest(mock.Mock()).process_notification(