Merge "Fixed various import issues exposed by unittest"
This commit is contained in:
commit
05a3a3150a
@ -35,6 +35,8 @@ UNKNOWN = 'insufficient data'
|
|||||||
OK = 'ok'
|
OK = 'ok'
|
||||||
ALARM = 'alarm'
|
ALARM = 'alarm'
|
||||||
|
|
||||||
|
cfg.CONF.import_group('service_credentials', 'ceilometer.service')
|
||||||
|
|
||||||
|
|
||||||
@six.add_metaclass(abc.ABCMeta)
|
@six.add_metaclass(abc.ABCMeta)
|
||||||
class Evaluator(object):
|
class Evaluator(object):
|
||||||
|
@ -132,9 +132,6 @@ class SingletonAlarmService(AlarmService, os_service.Service):
|
|||||||
'value': True}])
|
'value': True}])
|
||||||
|
|
||||||
|
|
||||||
cfg.CONF.import_opt('host', 'ceilometer.service')
|
|
||||||
|
|
||||||
|
|
||||||
class PartitionedAlarmService(AlarmService, os_service.Service):
|
class PartitionedAlarmService(AlarmService, os_service.Service):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -96,6 +96,7 @@ def cleanup():
|
|||||||
|
|
||||||
def get_rpc_server(transport, topic, endpoint):
|
def get_rpc_server(transport, topic, endpoint):
|
||||||
"""Return a configured oslo.messaging rpc server."""
|
"""Return a configured oslo.messaging rpc server."""
|
||||||
|
cfg.CONF.import_opt('host', 'ceilometer.service')
|
||||||
target = oslo.messaging.Target(server=cfg.CONF.host, topic=topic)
|
target = oslo.messaging.Target(server=cfg.CONF.host, topic=topic)
|
||||||
serializer = RequestContextSerializer(JsonPayloadSerializer())
|
serializer = RequestContextSerializer(JsonPayloadSerializer())
|
||||||
return oslo.messaging.get_rpc_server(transport, target,
|
return oslo.messaging.get_rpc_server(transport, target,
|
||||||
|
@ -55,6 +55,9 @@ class TestCoordinate(tests_base.BaseTestCase):
|
|||||||
self.setup_messaging(self.CONF)
|
self.setup_messaging(self.CONF)
|
||||||
|
|
||||||
self.test_interval = 120
|
self.test_interval = 120
|
||||||
|
self.CONF.import_opt('evaluation_interval',
|
||||||
|
'ceilometer.alarm.service',
|
||||||
|
group='alarm')
|
||||||
self.CONF.set_override('evaluation_interval',
|
self.CONF.set_override('evaluation_interval',
|
||||||
self.test_interval,
|
self.test_interval,
|
||||||
group='alarm')
|
group='alarm')
|
||||||
|
@ -26,6 +26,7 @@ from ceilometer.tests import db as db_test_base
|
|||||||
|
|
||||||
OPT_GROUP_NAME = 'keystone_authtoken'
|
OPT_GROUP_NAME = 'keystone_authtoken'
|
||||||
cfg.CONF.import_group(OPT_GROUP_NAME, "keystoneclient.middleware.auth_token")
|
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):
|
class FunctionalTest(db_test_base.TestBase):
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
"""Test the methods related to complex query."""
|
"""Test the methods related to complex query."""
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
import fixtures
|
import fixtures
|
||||||
import jsonschema
|
import jsonschema
|
||||||
import mock
|
import mock
|
||||||
@ -25,7 +26,7 @@ import wsme
|
|||||||
from ceilometer.alarm.storage import models as alarm_models
|
from ceilometer.alarm.storage import models as alarm_models
|
||||||
from ceilometer.api.controllers import v2 as api
|
from ceilometer.api.controllers import v2 as api
|
||||||
from ceilometer.openstack.common import test
|
from ceilometer.openstack.common import test
|
||||||
from ceilometer import storage
|
from ceilometer.storage import models
|
||||||
|
|
||||||
|
|
||||||
class FakeComplexQuery(api.ValidatedComplexQuery):
|
class FakeComplexQuery(api.ValidatedComplexQuery):
|
||||||
@ -50,7 +51,7 @@ class TestComplexQuery(test.BaseTestCase):
|
|||||||
super(TestComplexQuery, self).setUp()
|
super(TestComplexQuery, self).setUp()
|
||||||
self.useFixture(fixtures.MonkeyPatch(
|
self.useFixture(fixtures.MonkeyPatch(
|
||||||
'pecan.response', mock.MagicMock()))
|
'pecan.response', mock.MagicMock()))
|
||||||
self.query = FakeComplexQuery(storage.models.Sample,
|
self.query = FakeComplexQuery(models.Sample,
|
||||||
sample_name_mapping,
|
sample_name_mapping,
|
||||||
True)
|
True)
|
||||||
self.query_alarm = FakeComplexQuery(alarm_models.Alarm)
|
self.query_alarm = FakeComplexQuery(alarm_models.Alarm)
|
||||||
@ -236,7 +237,7 @@ class TestComplexQuery(test.BaseTestCase):
|
|||||||
class TestFilterSyntaxValidation(test.BaseTestCase):
|
class TestFilterSyntaxValidation(test.BaseTestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestFilterSyntaxValidation, self).setUp()
|
super(TestFilterSyntaxValidation, self).setUp()
|
||||||
self.query = FakeComplexQuery(storage.models.Sample,
|
self.query = FakeComplexQuery(models.Sample,
|
||||||
sample_name_mapping,
|
sample_name_mapping,
|
||||||
True)
|
True)
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@ import six
|
|||||||
|
|
||||||
import eventlet
|
import eventlet
|
||||||
import oslo.messaging
|
import oslo.messaging
|
||||||
|
import oslo.messaging.conffixture
|
||||||
from testtools import testcase
|
from testtools import testcase
|
||||||
|
|
||||||
from ceilometer import messaging
|
from ceilometer import messaging
|
||||||
|
@ -43,6 +43,9 @@ class TestCollector(tests_base.BaseTestCase):
|
|||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestCollector, self).setUp()
|
super(TestCollector, self).setUp()
|
||||||
self.CONF = self.useFixture(config.Config()).conf
|
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("connection", "log://", group='database')
|
||||||
self.CONF.set_override('metering_secret', 'not-so-secret',
|
self.CONF.set_override('metering_secret', 'not-so-secret',
|
||||||
group='publisher')
|
group='publisher')
|
||||||
|
@ -19,7 +19,7 @@ import mock
|
|||||||
|
|
||||||
from ceilometer import middleware
|
from ceilometer import middleware
|
||||||
from ceilometer.openstack.common.fixture import config
|
from ceilometer.openstack.common.fixture import config
|
||||||
from ceilometer.openstack.common import test
|
from ceilometer.tests import base
|
||||||
|
|
||||||
|
|
||||||
HTTP_REQUEST = {
|
HTTP_REQUEST = {
|
||||||
@ -68,11 +68,12 @@ HTTP_RESPONSE = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class TestNotifications(test.BaseTestCase):
|
class TestNotifications(base.BaseTestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestNotifications, self).setUp()
|
super(TestNotifications, self).setUp()
|
||||||
self.CONF = self.useFixture(config.Config()).conf
|
self.CONF = self.useFixture(config.Config()).conf
|
||||||
|
self.setup_messaging(self.CONF)
|
||||||
|
|
||||||
def test_process_request_notification(self):
|
def test_process_request_notification(self):
|
||||||
sample = list(middleware.HTTPRequest(mock.Mock()).process_notification(
|
sample = list(middleware.HTTPRequest(mock.Mock()).process_notification(
|
||||||
|
Loading…
Reference in New Issue
Block a user