Merge "Fixed various import issues exposed by unittest"

This commit is contained in:
Jenkins 2014-06-30 17:34:15 +00:00 committed by Gerrit Code Review
commit 05a3a3150a
9 changed files with 18 additions and 8 deletions

View File

@ -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):

View File

@ -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):

View File

@ -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,

View File

@ -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')

View File

@ -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):

View File

@ -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):
@ -50,7 +51,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)
@ -236,7 +237,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)

View File

@ -23,6 +23,7 @@ import six
import eventlet
import oslo.messaging
import oslo.messaging.conffixture
from testtools import testcase
from ceilometer import messaging

View File

@ -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')

View File

@ -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(