Merge "Switch to oslotest"
This commit is contained in:
commit
3006d5a77b
@ -1,85 +0,0 @@
|
||||
#
|
||||
# Copyright 2013 Mirantis, Inc.
|
||||
# Copyright 2013 OpenStack Foundation
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import fixtures
|
||||
from oslo.config import cfg
|
||||
import six
|
||||
|
||||
|
||||
class Config(fixtures.Fixture):
|
||||
"""Allows overriding configuration settings for the test.
|
||||
|
||||
`conf` will be reset on cleanup.
|
||||
|
||||
"""
|
||||
|
||||
def __init__(self, conf=cfg.CONF):
|
||||
self.conf = conf
|
||||
|
||||
def setUp(self):
|
||||
super(Config, self).setUp()
|
||||
# NOTE(morganfainberg): unregister must be added to cleanup before
|
||||
# reset is because cleanup works in reverse order of registered items,
|
||||
# and a reset must occur before unregistering options can occur.
|
||||
self.addCleanup(self._unregister_config_opts)
|
||||
self.addCleanup(self.conf.reset)
|
||||
self._registered_config_opts = {}
|
||||
|
||||
def config(self, **kw):
|
||||
"""Override configuration values.
|
||||
|
||||
The keyword arguments are the names of configuration options to
|
||||
override and their values.
|
||||
|
||||
If a `group` argument is supplied, the overrides are applied to
|
||||
the specified configuration option group, otherwise the overrides
|
||||
are applied to the ``default`` group.
|
||||
|
||||
"""
|
||||
|
||||
group = kw.pop('group', None)
|
||||
for k, v in six.iteritems(kw):
|
||||
self.conf.set_override(k, v, group)
|
||||
|
||||
def _unregister_config_opts(self):
|
||||
for group in self._registered_config_opts:
|
||||
self.conf.unregister_opts(self._registered_config_opts[group],
|
||||
group=group)
|
||||
|
||||
def register_opt(self, opt, group=None):
|
||||
"""Register a single option for the test run.
|
||||
|
||||
Options registered in this manner will automatically be unregistered
|
||||
during cleanup.
|
||||
|
||||
If a `group` argument is supplied, it will register the new option
|
||||
to that group, otherwise the option is registered to the ``default``
|
||||
group.
|
||||
"""
|
||||
self.conf.register_opt(opt, group=group)
|
||||
self._registered_config_opts.setdefault(group, set()).add(opt)
|
||||
|
||||
def register_opts(self, opts, group=None):
|
||||
"""Register multiple options for the test run.
|
||||
|
||||
This works in the same manner as register_opt() but takes a list of
|
||||
options as the first argument. All arguments will be registered to the
|
||||
same group if the ``group`` argument is supplied, otherwise all options
|
||||
will be registered to the ``default`` group.
|
||||
"""
|
||||
for opt in opts:
|
||||
self.register_opt(opt, group=group)
|
@ -1,51 +0,0 @@
|
||||
# Copyright 2011 OpenStack Foundation.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import fixtures
|
||||
|
||||
from ceilometer.openstack.common import lockutils
|
||||
|
||||
|
||||
class LockFixture(fixtures.Fixture):
|
||||
"""External locking fixture.
|
||||
|
||||
This fixture is basically an alternative to the synchronized decorator with
|
||||
the external flag so that tearDowns and addCleanups will be included in
|
||||
the lock context for locking between tests. The fixture is recommended to
|
||||
be the first line in a test method, like so::
|
||||
|
||||
def test_method(self):
|
||||
self.useFixture(LockFixture)
|
||||
...
|
||||
|
||||
or the first line in setUp if all the test methods in the class are
|
||||
required to be serialized. Something like::
|
||||
|
||||
class TestCase(testtools.testcase):
|
||||
def setUp(self):
|
||||
self.useFixture(LockFixture)
|
||||
super(TestCase, self).setUp()
|
||||
...
|
||||
|
||||
This is because addCleanups are put on a LIFO queue that gets run after the
|
||||
test method exits. (either by completing or raising an exception)
|
||||
"""
|
||||
def __init__(self, name, lock_file_prefix=None):
|
||||
self.mgr = lockutils.lock(name, lock_file_prefix, True)
|
||||
|
||||
def setUp(self):
|
||||
super(LockFixture, self).setUp()
|
||||
self.addCleanup(self.mgr.__exit__, None, None, None)
|
||||
self.lock = self.mgr.__enter__()
|
@ -1,34 +0,0 @@
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import fixtures
|
||||
|
||||
|
||||
def get_logging_handle_error_fixture():
|
||||
"""returns a fixture to make logging raise formatting exceptions.
|
||||
|
||||
Usage:
|
||||
self.useFixture(logging.get_logging_handle_error_fixture())
|
||||
"""
|
||||
return fixtures.MonkeyPatch('logging.Handler.handleError',
|
||||
_handleError)
|
||||
|
||||
|
||||
def _handleError(self, record):
|
||||
"""Monkey patch for logging.Handler.handleError.
|
||||
|
||||
The default handleError just logs the error to stderr but we want
|
||||
the option of actually raising an exception.
|
||||
"""
|
||||
raise
|
@ -1,62 +0,0 @@
|
||||
# Copyright 2010 United States Government as represented by the
|
||||
# Administrator of the National Aeronautics and Space Administration.
|
||||
# Copyright 2013 Hewlett-Packard Development Company, L.P.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
##############################################################################
|
||||
##############################################################################
|
||||
#
|
||||
# DO NOT MODIFY THIS FILE
|
||||
#
|
||||
# This file is being graduated to the oslotest library. Please make all
|
||||
# changes there, and only backport critical fixes here. - dhellmann
|
||||
#
|
||||
##############################################################################
|
||||
##############################################################################
|
||||
|
||||
import fixtures
|
||||
import mock
|
||||
|
||||
|
||||
class PatchObject(fixtures.Fixture):
|
||||
"""Deal with code around mock."""
|
||||
|
||||
def __init__(self, obj, attr, new=mock.DEFAULT, **kwargs):
|
||||
self.obj = obj
|
||||
self.attr = attr
|
||||
self.kwargs = kwargs
|
||||
self.new = new
|
||||
|
||||
def setUp(self):
|
||||
super(PatchObject, self).setUp()
|
||||
_p = mock.patch.object(self.obj, self.attr, self.new, **self.kwargs)
|
||||
self.mock = _p.start()
|
||||
self.addCleanup(_p.stop)
|
||||
|
||||
|
||||
class Patch(fixtures.Fixture):
|
||||
|
||||
"""Deal with code around mock.patch."""
|
||||
|
||||
def __init__(self, obj, new=mock.DEFAULT, **kwargs):
|
||||
self.obj = obj
|
||||
self.kwargs = kwargs
|
||||
self.new = new
|
||||
|
||||
def setUp(self):
|
||||
super(Patch, self).setUp()
|
||||
_p = mock.patch(self.obj, self.new, **self.kwargs)
|
||||
self.mock = _p.start()
|
||||
self.addCleanup(_p.stop)
|
@ -1,43 +0,0 @@
|
||||
# Copyright 2010 United States Government as represented by the
|
||||
# Administrator of the National Aeronautics and Space Administration.
|
||||
# Copyright 2013 Hewlett-Packard Development Company, L.P.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
##############################################################################
|
||||
##############################################################################
|
||||
#
|
||||
# DO NOT MODIFY THIS FILE
|
||||
#
|
||||
# This file is being graduated to the oslotest library. Please make all
|
||||
# changes there, and only backport critical fixes here. - dhellmann
|
||||
#
|
||||
##############################################################################
|
||||
##############################################################################
|
||||
|
||||
import fixtures
|
||||
from six.moves import mox
|
||||
|
||||
|
||||
class MoxStubout(fixtures.Fixture):
|
||||
"""Deal with code around mox and stubout as a fixture."""
|
||||
|
||||
def setUp(self):
|
||||
super(MoxStubout, self).setUp()
|
||||
# emulate some of the mox stuff, we can't use the metaclass
|
||||
# because it screws with our generators
|
||||
self.mox = mox.Mox()
|
||||
self.stubs = self.mox.stubs
|
||||
self.addCleanup(self.mox.UnsetStubs)
|
||||
self.addCleanup(self.mox.VerifyAll)
|
@ -1,99 +0,0 @@
|
||||
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
##############################################################################
|
||||
##############################################################################
|
||||
##
|
||||
## DO NOT MODIFY THIS FILE
|
||||
##
|
||||
## This file is being graduated to the ceilometertest library. Please make all
|
||||
## changes there, and only backport critical fixes here. - dhellmann
|
||||
##
|
||||
##############################################################################
|
||||
##############################################################################
|
||||
|
||||
"""Common utilities used in testing"""
|
||||
|
||||
import logging
|
||||
import os
|
||||
import tempfile
|
||||
|
||||
import fixtures
|
||||
import testtools
|
||||
|
||||
_TRUE_VALUES = ('True', 'true', '1', 'yes')
|
||||
_LOG_FORMAT = "%(levelname)8s [%(name)s] %(message)s"
|
||||
|
||||
|
||||
class BaseTestCase(testtools.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(BaseTestCase, self).setUp()
|
||||
self._set_timeout()
|
||||
self._fake_output()
|
||||
self._fake_logs()
|
||||
self.useFixture(fixtures.NestedTempfile())
|
||||
self.useFixture(fixtures.TempHomeDir())
|
||||
self.tempdirs = []
|
||||
|
||||
def _set_timeout(self):
|
||||
test_timeout = os.environ.get('OS_TEST_TIMEOUT', 0)
|
||||
try:
|
||||
test_timeout = int(test_timeout)
|
||||
except ValueError:
|
||||
# If timeout value is invalid do not set a timeout.
|
||||
test_timeout = 0
|
||||
if test_timeout > 0:
|
||||
self.useFixture(fixtures.Timeout(test_timeout, gentle=True))
|
||||
|
||||
def _fake_output(self):
|
||||
if os.environ.get('OS_STDOUT_CAPTURE') in _TRUE_VALUES:
|
||||
stdout = self.useFixture(fixtures.StringStream('stdout')).stream
|
||||
self.useFixture(fixtures.MonkeyPatch('sys.stdout', stdout))
|
||||
if os.environ.get('OS_STDERR_CAPTURE') in _TRUE_VALUES:
|
||||
stderr = self.useFixture(fixtures.StringStream('stderr')).stream
|
||||
self.useFixture(fixtures.MonkeyPatch('sys.stderr', stderr))
|
||||
|
||||
def _fake_logs(self):
|
||||
if os.environ.get('OS_DEBUG') in _TRUE_VALUES:
|
||||
level = logging.DEBUG
|
||||
else:
|
||||
level = logging.INFO
|
||||
capture_logs = os.environ.get('OS_LOG_CAPTURE') in _TRUE_VALUES
|
||||
if capture_logs:
|
||||
self.useFixture(
|
||||
fixtures.FakeLogger(
|
||||
format=_LOG_FORMAT,
|
||||
level=level,
|
||||
nuke_handlers=capture_logs,
|
||||
)
|
||||
)
|
||||
else:
|
||||
logging.basicConfig(format=_LOG_FORMAT, level=level)
|
||||
|
||||
def create_tempfiles(self, files, ext='.conf'):
|
||||
tempfiles = []
|
||||
for (basename, contents) in files:
|
||||
if not os.path.isabs(basename):
|
||||
(fd, path) = tempfile.mkstemp(prefix=basename, suffix=ext)
|
||||
else:
|
||||
path = basename + ext
|
||||
fd = os.open(path, os.O_CREAT | os.O_WRONLY)
|
||||
tempfiles.append(path)
|
||||
try:
|
||||
os.write(fd, contents)
|
||||
finally:
|
||||
os.close(fd)
|
||||
return tempfiles
|
@ -25,11 +25,11 @@ import copy
|
||||
import datetime
|
||||
|
||||
import mock
|
||||
from oslo.config import fixture as fixture_config
|
||||
from oslotest import mockpatch
|
||||
import six
|
||||
from stevedore import extension
|
||||
|
||||
from ceilometer.openstack.common.fixture import config
|
||||
from ceilometer.openstack.common.fixture import mockpatch
|
||||
from ceilometer import pipeline
|
||||
from ceilometer import plugin
|
||||
from ceilometer import publisher
|
||||
@ -231,7 +231,7 @@ class BaseAgentManagerTestCase(base.BaseTestCase):
|
||||
'publishers': ["test"],
|
||||
}, ]
|
||||
self.setup_pipeline()
|
||||
self.CONF = self.useFixture(config.Config()).conf
|
||||
self.CONF = self.useFixture(fixture_config.Config()).conf
|
||||
self.CONF.set_override(
|
||||
'pipeline_cfg_file',
|
||||
self.path_get('etc/ceilometer/pipeline.yaml')
|
||||
|
@ -18,11 +18,10 @@
|
||||
"""Base class for tests in ceilometer/alarm/evaluator/
|
||||
"""
|
||||
import mock
|
||||
|
||||
from ceilometer.openstack.common import test
|
||||
from oslotest import base
|
||||
|
||||
|
||||
class TestEvaluatorBase(test.BaseTestCase):
|
||||
class TestEvaluatorBase(base.BaseTestCase):
|
||||
def setUp(self):
|
||||
super(TestEvaluatorBase, self).setUp()
|
||||
self.api_client = mock.Mock()
|
||||
|
@ -18,13 +18,13 @@
|
||||
"""
|
||||
import datetime
|
||||
import mock
|
||||
from oslotest import base
|
||||
|
||||
from ceilometer.alarm import evaluator
|
||||
from ceilometer.openstack.common import test
|
||||
from ceilometer.openstack.common import timeutils
|
||||
|
||||
|
||||
class TestEvaluatorBaseClass(test.BaseTestCase):
|
||||
class TestEvaluatorBaseClass(base.BaseTestCase):
|
||||
def setUp(self):
|
||||
super(TestEvaluatorBaseClass, self).setUp()
|
||||
self.called = False
|
||||
|
@ -21,11 +21,11 @@ import logging
|
||||
import uuid
|
||||
|
||||
import mock
|
||||
from oslo.config import fixture as fixture_config
|
||||
from six import moves
|
||||
|
||||
from ceilometer.alarm.partition import coordination
|
||||
from ceilometer.alarm.storage import models
|
||||
from ceilometer.openstack.common.fixture import config
|
||||
from ceilometer.openstack.common import timeutils
|
||||
from ceilometer.tests import base as tests_base
|
||||
|
||||
@ -51,7 +51,7 @@ class MockLoggingHandler(logging.Handler):
|
||||
class TestCoordinate(tests_base.BaseTestCase):
|
||||
def setUp(self):
|
||||
super(TestCoordinate, self).setUp()
|
||||
self.CONF = self.useFixture(config.Config()).conf
|
||||
self.CONF = self.useFixture(fixture_config.Config()).conf
|
||||
self.setup_messaging(self.CONF)
|
||||
|
||||
self.test_interval = 120
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright 2013 eNovance
|
||||
# Copyright 2013-2014 eNovance
|
||||
#
|
||||
# Author: Julien Danjou <julien@danjou.info>
|
||||
#
|
||||
@ -17,13 +17,13 @@
|
||||
|
||||
import anyjson
|
||||
import mock
|
||||
from oslo.config import fixture as fixture_config
|
||||
from oslotest import mockpatch
|
||||
import requests
|
||||
import six.moves.urllib.parse as urlparse
|
||||
|
||||
from ceilometer.alarm import service
|
||||
from ceilometer.openstack.common import context
|
||||
from ceilometer.openstack.common.fixture import config
|
||||
from ceilometer.openstack.common.fixture import mockpatch
|
||||
from ceilometer.tests import base as tests_base
|
||||
|
||||
|
||||
@ -44,7 +44,7 @@ class TestAlarmNotifier(tests_base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestAlarmNotifier, self).setUp()
|
||||
self.CONF = self.useFixture(config.Config()).conf
|
||||
self.CONF = self.useFixture(fixture_config.Config()).conf
|
||||
self.setup_messaging(self.CONF)
|
||||
self.service = service.AlarmNotifierService()
|
||||
self.useFixture(mockpatch.Patch(
|
||||
|
@ -18,10 +18,10 @@
|
||||
"""
|
||||
import contextlib
|
||||
import mock
|
||||
from oslo.config import fixture as fixture_config
|
||||
from stevedore import extension
|
||||
|
||||
from ceilometer.alarm import service
|
||||
from ceilometer.openstack.common.fixture import config
|
||||
from ceilometer.tests import base as tests_base
|
||||
|
||||
|
||||
@ -31,7 +31,7 @@ class TestPartitionedAlarmService(tests_base.BaseTestCase):
|
||||
|
||||
self.threshold_eval = mock.Mock()
|
||||
self.api_client = mock.MagicMock()
|
||||
self.CONF = self.useFixture(config.Config()).conf
|
||||
self.CONF = self.useFixture(fixture_config.Config()).conf
|
||||
|
||||
self.CONF.set_override('host',
|
||||
'fake_host')
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright 2013 eNovance <licensing@enovance.com>
|
||||
# Copyright 2013-2014 eNovance <licensing@enovance.com>
|
||||
#
|
||||
# Authors: Mehdi Abaakouk <mehdi.abaakouk@enovance.com>
|
||||
#
|
||||
@ -19,12 +19,12 @@ import uuid
|
||||
|
||||
from ceilometerclient.v2 import alarms
|
||||
import eventlet
|
||||
from oslo.config import fixture as fixture_config
|
||||
import six
|
||||
|
||||
from ceilometer.alarm import rpc as rpc_alarm
|
||||
from ceilometer.alarm.storage import models
|
||||
from ceilometer import messaging
|
||||
from ceilometer.openstack.common.fixture import config
|
||||
from ceilometer.openstack.common import timeutils
|
||||
from ceilometer.tests import base as tests_base
|
||||
|
||||
@ -48,7 +48,7 @@ class FakeNotifier(object):
|
||||
class TestRPCAlarmNotifier(tests_base.BaseTestCase):
|
||||
def setUp(self):
|
||||
super(TestRPCAlarmNotifier, self).setUp()
|
||||
self.CONF = self.useFixture(config.Config()).conf
|
||||
self.CONF = self.useFixture(fixture_config.Config()).conf
|
||||
self.setup_messaging(self.CONF)
|
||||
|
||||
self.notifier_server = FakeNotifier(self.transport)
|
||||
@ -169,7 +169,7 @@ class FakeCoordinator(object):
|
||||
class TestRPCAlarmPartitionCoordination(tests_base.BaseTestCase):
|
||||
def setUp(self):
|
||||
super(TestRPCAlarmPartitionCoordination, self).setUp()
|
||||
self.CONF = self.useFixture(config.Config()).conf
|
||||
self.CONF = self.useFixture(fixture_config.Config()).conf
|
||||
self.setup_messaging(self.CONF)
|
||||
|
||||
self.coordinator_server = FakeCoordinator(self.transport)
|
||||
|
@ -17,17 +17,17 @@
|
||||
"""Tests for ceilometer.alarm.service.SingletonAlarmService.
|
||||
"""
|
||||
import mock
|
||||
from oslo.config import fixture as fixture_config
|
||||
from stevedore import extension
|
||||
|
||||
from ceilometer.alarm import service
|
||||
from ceilometer.openstack.common.fixture import config
|
||||
from ceilometer.tests import base as tests_base
|
||||
|
||||
|
||||
class TestSingletonAlarmService(tests_base.BaseTestCase):
|
||||
def setUp(self):
|
||||
super(TestSingletonAlarmService, self).setUp()
|
||||
self.CONF = self.useFixture(config.Config()).conf
|
||||
self.CONF = self.useFixture(fixture_config.Config()).conf
|
||||
self.setup_messaging(self.CONF)
|
||||
|
||||
self.threshold_eval = mock.Mock()
|
||||
|
@ -18,10 +18,10 @@
|
||||
"""
|
||||
|
||||
from oslo.config import cfg
|
||||
from oslo.config import fixture as fixture_config
|
||||
import pecan
|
||||
import pecan.testing
|
||||
|
||||
from ceilometer.openstack.common.fixture import config
|
||||
from ceilometer.tests import db as db_test_base
|
||||
|
||||
OPT_GROUP_NAME = 'keystone_authtoken'
|
||||
@ -40,7 +40,7 @@ class FunctionalTest(db_test_base.TestBase):
|
||||
|
||||
def setUp(self):
|
||||
super(FunctionalTest, self).setUp()
|
||||
self.CONF = self.useFixture(config.Config()).conf
|
||||
self.CONF = self.useFixture(fixture_config.Config()).conf
|
||||
self.setup_messaging(self.CONF)
|
||||
|
||||
self.CONF.set_override("auth_version", "v2.0",
|
||||
|
@ -18,9 +18,9 @@
|
||||
import socket
|
||||
|
||||
from oslo.config import cfg
|
||||
from oslo.config import fixture as fixture_config
|
||||
|
||||
from ceilometer.api import app
|
||||
from ceilometer.openstack.common.fixture import config
|
||||
from ceilometer.tests import base
|
||||
|
||||
|
||||
@ -28,7 +28,7 @@ class TestApp(base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestApp, self).setUp()
|
||||
self.CONF = self.useFixture(config.Config()).conf
|
||||
self.CONF = self.useFixture(fixture_config.Config()).conf
|
||||
|
||||
def test_WSGI_address_family(self):
|
||||
self.CONF.set_override('host', '::', group='api')
|
||||
|
@ -21,11 +21,11 @@ import datetime
|
||||
import fixtures
|
||||
import jsonschema
|
||||
import mock
|
||||
from oslotest import base
|
||||
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.storage import models
|
||||
|
||||
|
||||
@ -46,7 +46,7 @@ sample_name_mapping = {"resource": "resource_id",
|
||||
"volume": "counter_volume"}
|
||||
|
||||
|
||||
class TestComplexQuery(test.BaseTestCase):
|
||||
class TestComplexQuery(base.BaseTestCase):
|
||||
def setUp(self):
|
||||
super(TestComplexQuery, self).setUp()
|
||||
self.useFixture(fixtures.MonkeyPatch(
|
||||
@ -234,7 +234,7 @@ class TestComplexQuery(test.BaseTestCase):
|
||||
orderby)
|
||||
|
||||
|
||||
class TestFilterSyntaxValidation(test.BaseTestCase):
|
||||
class TestFilterSyntaxValidation(base.BaseTestCase):
|
||||
def setUp(self):
|
||||
super(TestFilterSyntaxValidation, self).setUp()
|
||||
self.query = FakeComplexQuery(models.Sample,
|
||||
|
@ -21,8 +21,8 @@ import copy
|
||||
import datetime
|
||||
|
||||
import mock
|
||||
from oslotest import mockpatch
|
||||
|
||||
from ceilometer.openstack.common.fixture import mockpatch
|
||||
from ceilometer.openstack.common import timeutils
|
||||
from ceilometer.tests.api import v2
|
||||
from ceilometer.tests import db as tests_db
|
||||
|
@ -18,17 +18,17 @@ import datetime
|
||||
|
||||
import fixtures
|
||||
import mock
|
||||
from oslotest import base
|
||||
from oslotest import mockpatch
|
||||
import wsme
|
||||
|
||||
from ceilometer.api.controllers import v2 as api
|
||||
from ceilometer.openstack.common.fixture import mockpatch
|
||||
from ceilometer.openstack.common import test
|
||||
from ceilometer.openstack.common import timeutils
|
||||
from ceilometer import storage
|
||||
from ceilometer.tests import base as tests_base
|
||||
|
||||
|
||||
class TestQuery(test.BaseTestCase):
|
||||
class TestQuery(base.BaseTestCase):
|
||||
def setUp(self):
|
||||
super(TestQuery, self).setUp()
|
||||
self.useFixture(fixtures.MonkeyPatch(
|
||||
@ -143,7 +143,7 @@ class TestQuery(test.BaseTestCase):
|
||||
self.assertEqual(expected, query._get_value_as_type())
|
||||
|
||||
|
||||
class TestValidateGroupByFields(test.BaseTestCase):
|
||||
class TestValidateGroupByFields(base.BaseTestCase):
|
||||
|
||||
def test_valid_field(self):
|
||||
result = api._validate_groupby_fields(['user_id'])
|
||||
|
@ -18,11 +18,12 @@
|
||||
|
||||
import datetime
|
||||
|
||||
from oslotest import base
|
||||
|
||||
from ceilometer.api.controllers import v2
|
||||
from ceilometer.openstack.common import test
|
||||
|
||||
|
||||
class TestStatisticsDuration(test.BaseTestCase):
|
||||
class TestStatisticsDuration(base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestStatisticsDuration, self).setUp()
|
||||
|
@ -14,14 +14,13 @@
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from oslotest import base
|
||||
import wsme
|
||||
|
||||
from ceilometer.api.controllers import v2
|
||||
from ceilometer.openstack.common import test
|
||||
|
||||
|
||||
class TestWsmeCustomType(test.BaseTestCase):
|
||||
class TestWsmeCustomType(base.BaseTestCase):
|
||||
|
||||
def test_advenum_default(self):
|
||||
class dummybase(wsme.types.Base):
|
||||
|
@ -22,16 +22,16 @@ import os.path
|
||||
|
||||
import eventlet
|
||||
import oslo.messaging.conffixture
|
||||
from oslotest import base
|
||||
from oslotest import mockpatch
|
||||
import six
|
||||
from testtools import testcase
|
||||
|
||||
from ceilometer import messaging
|
||||
from ceilometer.openstack.common.fixture import mockpatch
|
||||
from ceilometer.openstack.common import test
|
||||
from ceilometer.openstack.common import timeutils
|
||||
|
||||
|
||||
class BaseTestCase(test.BaseTestCase):
|
||||
class BaseTestCase(base.BaseTestCase):
|
||||
def setup_messaging(self, conf, exchange=None):
|
||||
self.useFixture(oslo.messaging.conffixture.ConfFixture(conf))
|
||||
conf.set_override("notification_driver", "messaging")
|
||||
|
@ -18,17 +18,17 @@
|
||||
"""
|
||||
|
||||
import mock
|
||||
from oslotest import base
|
||||
from oslotest import mockpatch
|
||||
from stevedore import extension
|
||||
|
||||
from ceilometer.central import manager
|
||||
from ceilometer.central import plugin
|
||||
from ceilometer.openstack.common.fixture import mockpatch
|
||||
from ceilometer.openstack.common import test
|
||||
from ceilometer import pipeline
|
||||
from ceilometer.tests import agentbase
|
||||
|
||||
|
||||
class TestManager(test.BaseTestCase):
|
||||
class TestManager(base.BaseTestCase):
|
||||
|
||||
@mock.patch('ceilometer.pipeline.setup_pipeline', mock.MagicMock())
|
||||
def test_load_plugins(self):
|
||||
|
@ -20,8 +20,9 @@ notification events.
|
||||
|
||||
import copy
|
||||
|
||||
from oslotest import base
|
||||
|
||||
from ceilometer.compute.notifications import cpu
|
||||
from ceilometer.openstack.common import test
|
||||
|
||||
|
||||
METRICS_UPDATE = {
|
||||
@ -88,7 +89,7 @@ RES_ID = '%s_%s' % (METRICS_UPDATE['payload']['host'],
|
||||
METRICS_UPDATE['payload']['nodename'])
|
||||
|
||||
|
||||
class TestMetricsNotifications(test.BaseTestCase):
|
||||
class TestMetricsNotifications(base.BaseTestCase):
|
||||
def _process_notification(self, ic):
|
||||
self.assertIn(METRICS_UPDATE['event_type'],
|
||||
ic.event_types)
|
||||
|
@ -19,9 +19,9 @@
|
||||
"""Tests for converters for producing compute counter messages from
|
||||
notification events.
|
||||
"""
|
||||
from oslotest import base
|
||||
|
||||
from ceilometer.compute.notifications import instance
|
||||
from ceilometer.openstack.common import test
|
||||
from ceilometer import sample
|
||||
|
||||
|
||||
@ -593,7 +593,7 @@ INSTANCE_SCHEDULED = {
|
||||
}
|
||||
|
||||
|
||||
class TestNotifications(test.BaseTestCase):
|
||||
class TestNotifications(base.BaseTestCase):
|
||||
|
||||
def test_process_notification(self):
|
||||
info = list(instance.Instance(None).process_notification(
|
||||
|
@ -18,8 +18,8 @@
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from oslotest import mockpatch
|
||||
|
||||
from ceilometer.openstack.common.fixture import mockpatch
|
||||
import ceilometer.tests.base as base
|
||||
|
||||
|
||||
|
@ -20,11 +20,11 @@
|
||||
"""
|
||||
|
||||
import mock
|
||||
from oslotest import base
|
||||
import six
|
||||
|
||||
from ceilometer.compute import manager
|
||||
from ceilometer.compute.pollsters import util
|
||||
from ceilometer.openstack.common import test
|
||||
|
||||
|
||||
class FauxInstance(object):
|
||||
@ -43,7 +43,7 @@ class FauxInstance(object):
|
||||
return default
|
||||
|
||||
|
||||
class TestLocationMetadata(test.BaseTestCase):
|
||||
class TestLocationMetadata(base.BaseTestCase):
|
||||
|
||||
@mock.patch('ceilometer.pipeline.setup_pipeline', mock.MagicMock())
|
||||
def setUp(self):
|
||||
|
@ -17,16 +17,16 @@
|
||||
"""Tests for ceilometer/agent/manager.py
|
||||
"""
|
||||
import mock
|
||||
from oslotest import base
|
||||
from oslotest import mockpatch
|
||||
|
||||
from ceilometer import agent
|
||||
from ceilometer.compute import manager
|
||||
from ceilometer import nova_client
|
||||
from ceilometer.openstack.common.fixture import mockpatch
|
||||
from ceilometer.openstack.common import test
|
||||
from ceilometer.tests import agentbase
|
||||
|
||||
|
||||
class TestManager(test.BaseTestCase):
|
||||
class TestManager(base.BaseTestCase):
|
||||
|
||||
@mock.patch('ceilometer.pipeline.setup_pipeline', mock.MagicMock())
|
||||
def test_load_plugins(self):
|
||||
|
@ -18,13 +18,13 @@ Tests for Hyper-V inspector.
|
||||
"""
|
||||
|
||||
import mock
|
||||
from oslotest import base
|
||||
|
||||
from ceilometer.compute.virt.hyperv import inspector as hyperv_inspector
|
||||
from ceilometer.openstack.common import test
|
||||
from ceilometer.openstack.common import units
|
||||
|
||||
|
||||
class TestHyperVInspection(test.BaseTestCase):
|
||||
class TestHyperVInspection(base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
self._inspector = hyperv_inspector.HyperVInspector()
|
||||
|
@ -18,13 +18,13 @@ Tests for Hyper-V utilsv2.
|
||||
"""
|
||||
|
||||
import mock
|
||||
from oslotest import base
|
||||
|
||||
from ceilometer.compute.virt.hyperv import utilsv2 as utilsv2
|
||||
from ceilometer.compute.virt import inspector
|
||||
from ceilometer.openstack.common import test
|
||||
|
||||
|
||||
class TestUtilsV2(test.BaseTestCase):
|
||||
class TestUtilsV2(base.BaseTestCase):
|
||||
|
||||
_FAKE_RETURN_CLASS = 'fake_return_class'
|
||||
|
||||
|
@ -22,13 +22,13 @@ import contextlib
|
||||
|
||||
import fixtures
|
||||
import mock
|
||||
from oslotest import base
|
||||
|
||||
from ceilometer.compute.virt import inspector as virt_inspector
|
||||
from ceilometer.compute.virt.libvirt import inspector as libvirt_inspector
|
||||
from ceilometer.openstack.common import test
|
||||
|
||||
|
||||
class TestLibvirtInspection(test.BaseTestCase):
|
||||
class TestLibvirtInspection(base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestLibvirtInspection, self).setUp()
|
||||
@ -246,7 +246,7 @@ class TestLibvirtInspection(test.BaseTestCase):
|
||||
self.assertEqual(disks, [])
|
||||
|
||||
|
||||
class TestLibvirtInspectionWithError(test.BaseTestCase):
|
||||
class TestLibvirtInspectionWithError(base.BaseTestCase):
|
||||
|
||||
class fakeLibvirtError(Exception):
|
||||
pass
|
||||
|
@ -18,13 +18,13 @@ Tests for VMware Vsphere inspector.
|
||||
|
||||
import mock
|
||||
from oslo.vmware import api
|
||||
from oslotest import base
|
||||
|
||||
from ceilometer.compute.virt import inspector as virt_inspector
|
||||
from ceilometer.compute.virt.vmware import inspector as vsphere_inspector
|
||||
from ceilometer.openstack.common import test
|
||||
|
||||
|
||||
class TestVsphereInspection(test.BaseTestCase):
|
||||
class TestVsphereInspection(base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
api_session = api.VMwareAPISession("test_server", "test_user",
|
||||
|
@ -15,12 +15,12 @@
|
||||
|
||||
import mock
|
||||
from oslo.vmware import api
|
||||
from oslotest import base
|
||||
|
||||
from ceilometer.compute.virt.vmware import vsphere_operations
|
||||
from ceilometer.openstack.common import test
|
||||
|
||||
|
||||
class VsphereOperationsTest(test.BaseTestCase):
|
||||
class VsphereOperationsTest(base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
api_session = api.VMwareAPISession("test_server", "test_user",
|
||||
|
@ -17,10 +17,10 @@ import datetime
|
||||
|
||||
import mock
|
||||
from oslo.config import cfg
|
||||
from oslotest import base
|
||||
|
||||
from ceilometer.data_processing import notifications
|
||||
from ceilometer.openstack.common import log
|
||||
from ceilometer.openstack.common import test
|
||||
from ceilometer import sample
|
||||
|
||||
NOW = datetime.datetime.isoformat(datetime.datetime.utcnow())
|
||||
@ -71,7 +71,7 @@ def _dp_notification_for(operation):
|
||||
}
|
||||
|
||||
|
||||
class TestNotification(test.BaseTestCase):
|
||||
class TestNotification(base.BaseTestCase):
|
||||
def _verify_common_sample(self, actual, operation):
|
||||
self.assertIsNotNone(actual)
|
||||
self.assertEqual('cluster.%s' % operation, actual.name)
|
||||
|
@ -23,13 +23,13 @@ import os
|
||||
import uuid
|
||||
import warnings
|
||||
|
||||
from oslo.config import fixture as fixture_config
|
||||
from oslotest import mockpatch
|
||||
import six
|
||||
from six.moves.urllib import parse as urlparse
|
||||
import testscenarios.testcase
|
||||
from testtools import testcase
|
||||
|
||||
from ceilometer.openstack.common.fixture import config
|
||||
import ceilometer.openstack.common.fixture.mockpatch as oslo_mock
|
||||
from ceilometer import storage
|
||||
from ceilometer.tests import base as test_base
|
||||
|
||||
@ -125,10 +125,10 @@ class TestBase(testscenarios.testcase.WithScenarios, test_base.BaseTestCase):
|
||||
self.alarm_conn = self.db_manager.alarm_connection
|
||||
self.alarm_conn.upgrade()
|
||||
|
||||
self.useFixture(oslo_mock.Patch('ceilometer.storage.get_connection',
|
||||
self.useFixture(mockpatch.Patch('ceilometer.storage.get_connection',
|
||||
side_effect=self._get_connection))
|
||||
|
||||
self.CONF = self.useFixture(config.Config()).conf
|
||||
self.CONF = self.useFixture(fixture_config.Config()).conf
|
||||
self.CONF([], project='ceilometer')
|
||||
|
||||
# Set a default location for the pipeline config file so the
|
||||
|
@ -17,18 +17,18 @@
|
||||
import datetime
|
||||
|
||||
import mock
|
||||
from oslo.config import fixture as fixture_config
|
||||
from oslotest import base
|
||||
|
||||
from ceilometer.dispatcher import database
|
||||
from ceilometer.openstack.common.fixture import config
|
||||
from ceilometer.openstack.common import test
|
||||
from ceilometer.publisher import utils
|
||||
|
||||
|
||||
class TestDispatcherDB(test.BaseTestCase):
|
||||
class TestDispatcherDB(base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestDispatcherDB, self).setUp()
|
||||
self.CONF = self.useFixture(config.Config()).conf
|
||||
self.CONF = self.useFixture(fixture_config.Config()).conf
|
||||
self.CONF.set_override('connection', 'sqlite://', group='database')
|
||||
self.dispatcher = database.DatabaseDispatcher(self.CONF)
|
||||
self.ctx = None
|
||||
|
@ -18,17 +18,18 @@ import logging.handlers
|
||||
import os
|
||||
import tempfile
|
||||
|
||||
from oslo.config import fixture as fixture_config
|
||||
from oslotest import base
|
||||
|
||||
from ceilometer.dispatcher import file
|
||||
from ceilometer.openstack.common.fixture import config
|
||||
from ceilometer.openstack.common import test
|
||||
from ceilometer.publisher import utils
|
||||
|
||||
|
||||
class TestDispatcherFile(test.BaseTestCase):
|
||||
class TestDispatcherFile(base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestDispatcherFile, self).setUp()
|
||||
self.CONF = self.useFixture(config.Config()).conf
|
||||
self.CONF = self.useFixture(fixture_config.Config()).conf
|
||||
|
||||
def test_file_dispatcher_with_all_config(self):
|
||||
# Create a temporaryFile to get a file name
|
||||
|
@ -18,13 +18,13 @@ import datetime
|
||||
|
||||
from keystoneclient import exceptions
|
||||
import mock
|
||||
from oslotest import base
|
||||
from oslotest import mockpatch
|
||||
import six
|
||||
|
||||
from ceilometer.central import manager
|
||||
from ceilometer.energy import kwapi
|
||||
from ceilometer.openstack.common import context
|
||||
from ceilometer.openstack.common.fixture import mockpatch
|
||||
from ceilometer.openstack.common import test
|
||||
|
||||
|
||||
PROBE_DICT = {
|
||||
@ -55,7 +55,7 @@ class TestManager(manager.AgentManager):
|
||||
self.keystone = mock.Mock()
|
||||
|
||||
|
||||
class TestKwapi(test.BaseTestCase):
|
||||
class TestKwapi(base.BaseTestCase):
|
||||
|
||||
@mock.patch('ceilometer.pipeline.setup_pipeline', mock.MagicMock())
|
||||
def setUp(self):
|
||||
@ -76,7 +76,7 @@ class TestKwapi(test.BaseTestCase):
|
||||
self.assertEqual(0, len(samples))
|
||||
|
||||
|
||||
class TestEnergyPollster(test.BaseTestCase):
|
||||
class TestEnergyPollster(base.BaseTestCase):
|
||||
|
||||
@mock.patch('ceilometer.pipeline.setup_pipeline', mock.MagicMock())
|
||||
def setUp(self):
|
||||
@ -114,7 +114,7 @@ class TestEnergyPollster(test.BaseTestCase):
|
||||
# power_samples)))
|
||||
|
||||
|
||||
class TestEnergyPollsterCache(test.BaseTestCase):
|
||||
class TestEnergyPollsterCache(base.BaseTestCase):
|
||||
|
||||
@mock.patch('ceilometer.pipeline.setup_pipeline', mock.MagicMock())
|
||||
def setUp(self):
|
||||
@ -136,7 +136,7 @@ class TestEnergyPollsterCache(test.BaseTestCase):
|
||||
self.assertEqual(1, len(samples))
|
||||
|
||||
|
||||
class TestPowerPollster(test.BaseTestCase):
|
||||
class TestPowerPollster(base.BaseTestCase):
|
||||
|
||||
@mock.patch('ceilometer.pipeline.setup_pipeline', mock.MagicMock())
|
||||
def setUp(self):
|
||||
@ -171,7 +171,7 @@ class TestPowerPollster(test.BaseTestCase):
|
||||
self.assertEqual(probe['w'], sample.volume)
|
||||
|
||||
|
||||
class TestPowerPollsterCache(test.BaseTestCase):
|
||||
class TestPowerPollsterCache(base.BaseTestCase):
|
||||
|
||||
@mock.patch('ceilometer.pipeline.setup_pipeline', mock.MagicMock())
|
||||
def setUp(self):
|
||||
|
@ -18,11 +18,11 @@
|
||||
|
||||
import mock
|
||||
from oslo.config import cfg
|
||||
from oslo.config import fixture as fixture_config
|
||||
import oslo.messaging
|
||||
from stevedore import extension
|
||||
|
||||
from ceilometer.event import endpoint as event_endpoint
|
||||
from ceilometer.openstack.common.fixture import config
|
||||
from ceilometer.storage import models
|
||||
from ceilometer.tests import base as tests_base
|
||||
|
||||
@ -86,7 +86,7 @@ class TestEventEndpoint(tests_base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestEventEndpoint, self).setUp()
|
||||
self.CONF = self.useFixture(config.Config()).conf
|
||||
self.CONF = self.useFixture(fixture_config.Config()).conf
|
||||
self.CONF([])
|
||||
self.CONF.set_override("connection", "log://", group='database')
|
||||
self.CONF.set_override("store_events", True, group="notification")
|
||||
|
@ -14,12 +14,12 @@
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
from oslotest import base
|
||||
|
||||
from ceilometer.event import trait_plugins
|
||||
from ceilometer.openstack.common import test
|
||||
|
||||
|
||||
class TestSplitterPlugin(test.BaseTestCase):
|
||||
class TestSplitterPlugin(base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestSplitterPlugin, self).setUp()
|
||||
@ -66,7 +66,7 @@ class TestSplitterPlugin(test.BaseTestCase):
|
||||
self.assertIs(None, value)
|
||||
|
||||
|
||||
class TestBitfieldPlugin(test.BaseTestCase):
|
||||
class TestBitfieldPlugin(base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestBitfieldPlugin, self).setUp()
|
||||
|
@ -16,9 +16,9 @@
|
||||
# under the License.
|
||||
"""Tests for ceilometer/hardware/inspector/snmp/inspector.py
|
||||
"""
|
||||
from oslotest import mockpatch
|
||||
|
||||
from ceilometer.hardware.inspector import snmp
|
||||
from ceilometer.openstack.common.fixture import mockpatch
|
||||
from ceilometer.openstack.common import network_utils
|
||||
from ceilometer.tests import base as test_base
|
||||
from ceilometer.tests.hardware.inspector import base
|
||||
|
@ -18,14 +18,14 @@
|
||||
"""
|
||||
|
||||
import mock
|
||||
from oslotest import base
|
||||
|
||||
from ceilometer.hardware.notifications import ipmi
|
||||
from ceilometer.openstack.common import test
|
||||
from ceilometer import sample
|
||||
from ceilometer.tests.hardware.notifications import ipmi_test_data
|
||||
|
||||
|
||||
class TestNotifications(test.BaseTestCase):
|
||||
class TestNotifications(base.BaseTestCase):
|
||||
|
||||
def test_ipmi_temperature_notification(self):
|
||||
"""Test IPMI Temperature sensor data.
|
||||
|
@ -13,9 +13,9 @@
|
||||
import datetime
|
||||
|
||||
import mock
|
||||
from oslotest import base
|
||||
|
||||
from ceilometer.identity import notifications
|
||||
from ceilometer.openstack.common import test
|
||||
from ceilometer import sample
|
||||
|
||||
|
||||
@ -80,7 +80,7 @@ def authn_notification_for(outcome):
|
||||
}
|
||||
|
||||
|
||||
class TestCRUDNotification(test.BaseTestCase):
|
||||
class TestCRUDNotification(base.BaseTestCase):
|
||||
|
||||
def _verify_common_sample(self, s):
|
||||
self.assertIsNotNone(s)
|
||||
@ -148,7 +148,7 @@ class TestCRUDNotification(test.BaseTestCase):
|
||||
self._test_operation('trust', 'deleted', TRUST_ID, notifications.Trust)
|
||||
|
||||
|
||||
class TestAuthenticationNotification(test.BaseTestCase):
|
||||
class TestAuthenticationNotification(base.BaseTestCase):
|
||||
|
||||
def _verify_common_sample(self, s):
|
||||
self.assertIsNotNone(s)
|
||||
|
@ -16,13 +16,13 @@
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from oslo.config import fixture as fixture_config
|
||||
from oslotest import base
|
||||
from oslotest import mockpatch
|
||||
|
||||
from ceilometer.central import manager
|
||||
from ceilometer.image import glance
|
||||
from ceilometer.openstack.common import context
|
||||
from ceilometer.openstack.common.fixture import config
|
||||
from ceilometer.openstack.common.fixture import mockpatch
|
||||
from ceilometer.openstack.common import test
|
||||
|
||||
IMAGE_LIST = [
|
||||
type('Image', (object,),
|
||||
@ -121,7 +121,7 @@ class TestManager(manager.AgentManager):
|
||||
self.keystone = mock.Mock()
|
||||
|
||||
|
||||
class TestImagePollsterPageSize(test.BaseTestCase):
|
||||
class TestImagePollsterPageSize(base.BaseTestCase):
|
||||
|
||||
def fake_get_glance_client(self, ksclient):
|
||||
glanceclient = FakeGlanceClient()
|
||||
@ -136,7 +136,7 @@ class TestImagePollsterPageSize(test.BaseTestCase):
|
||||
self.useFixture(mockpatch.PatchObject(
|
||||
glance._Base, 'get_glance_client',
|
||||
side_effect=self.fake_get_glance_client))
|
||||
self.CONF = self.useFixture(config.Config()).conf
|
||||
self.CONF = self.useFixture(fixture_config.Config()).conf
|
||||
|
||||
def _do_test_iter_images(self, page_size=0):
|
||||
self.CONF.set_override("glance_page_size", page_size)
|
||||
@ -159,7 +159,7 @@ class TestImagePollsterPageSize(test.BaseTestCase):
|
||||
self._do_test_iter_images(-1)
|
||||
|
||||
|
||||
class TestImagePollster(test.BaseTestCase):
|
||||
class TestImagePollster(base.BaseTestCase):
|
||||
|
||||
def fake_get_glance_client(self, ksclient):
|
||||
glanceclient = _BaseObject()
|
||||
|
@ -19,9 +19,9 @@
|
||||
import datetime
|
||||
|
||||
import mock
|
||||
from oslotest import base
|
||||
|
||||
from ceilometer.image import notifications
|
||||
from ceilometer.openstack.common import test
|
||||
from ceilometer import sample
|
||||
|
||||
|
||||
@ -90,7 +90,7 @@ NOTIFICATION_DELETE = {"message_id": "0c65cb9c-018c-11e2-bc91-5453ed1bbb5f",
|
||||
"timestamp": NOW}
|
||||
|
||||
|
||||
class TestNotification(test.BaseTestCase):
|
||||
class TestNotification(base.BaseTestCase):
|
||||
|
||||
def _verify_common_counter(self, c, name, volume):
|
||||
self.assertIsNotNone(c)
|
||||
|
@ -16,16 +16,16 @@
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from oslotest import base
|
||||
from oslotest import mockpatch
|
||||
|
||||
from ceilometer.central import manager
|
||||
from ceilometer.network.services import discovery
|
||||
from ceilometer.network.services import fwaas
|
||||
from ceilometer.openstack.common import context
|
||||
from ceilometer.openstack.common.fixture import mockpatch
|
||||
from ceilometer.openstack.common import test
|
||||
|
||||
|
||||
class _BaseTestFWPollster(test.BaseTestCase):
|
||||
class _BaseTestFWPollster(base.BaseTestCase):
|
||||
|
||||
@mock.patch('ceilometer.pipeline.setup_pipeline', mock.MagicMock())
|
||||
def setUp(self):
|
||||
|
@ -16,16 +16,16 @@
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from oslotest import base
|
||||
from oslotest import mockpatch
|
||||
|
||||
from ceilometer.central import manager
|
||||
from ceilometer.network.services import discovery
|
||||
from ceilometer.network.services import lbaas
|
||||
from ceilometer.openstack.common import context
|
||||
from ceilometer.openstack.common.fixture import mockpatch
|
||||
from ceilometer.openstack.common import test
|
||||
|
||||
|
||||
class _BaseTestLBPollster(test.BaseTestCase):
|
||||
class _BaseTestLBPollster(base.BaseTestCase):
|
||||
|
||||
@mock.patch('ceilometer.pipeline.setup_pipeline', mock.MagicMock())
|
||||
def setUp(self):
|
||||
|
@ -16,16 +16,16 @@
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from oslotest import base
|
||||
from oslotest import mockpatch
|
||||
|
||||
from ceilometer.central import manager
|
||||
from ceilometer.network.services import discovery
|
||||
from ceilometer.network.services import vpnaas
|
||||
from ceilometer.openstack.common import context
|
||||
from ceilometer.openstack.common.fixture import mockpatch
|
||||
from ceilometer.openstack.common import test
|
||||
|
||||
|
||||
class _BaseTestVPNPollster(test.BaseTestCase):
|
||||
class _BaseTestVPNPollster(base.BaseTestCase):
|
||||
|
||||
@mock.patch('ceilometer.pipeline.setup_pipeline', mock.MagicMock())
|
||||
def setUp(self):
|
||||
|
@ -13,10 +13,10 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from ceilometer.openstack.common import test
|
||||
from oslotest import base
|
||||
|
||||
|
||||
class _PollsterTestBase(test.BaseTestCase):
|
||||
class _PollsterTestBase(base.BaseTestCase):
|
||||
|
||||
def _test_pollster(self, pollster_class, meter_name,
|
||||
meter_type, meter_unit):
|
||||
|
@ -15,12 +15,12 @@
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from oslotest import base
|
||||
|
||||
from ceilometer.network.statistics.opencontrail import client
|
||||
from ceilometer.openstack.common import test
|
||||
|
||||
|
||||
class TestOpencontrailClient(test.BaseTestCase):
|
||||
class TestOpencontrailClient(base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestOpencontrailClient, self).setUp()
|
||||
|
@ -15,13 +15,13 @@
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from oslotest import base
|
||||
from six.moves.urllib import parse as urlparse
|
||||
|
||||
from ceilometer.network.statistics.opencontrail import driver
|
||||
from ceilometer.openstack.common import test
|
||||
|
||||
|
||||
class TestOpencontrailDriver(test.BaseTestCase):
|
||||
class TestOpencontrailDriver(base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestOpencontrailDriver, self).setUp()
|
||||
|
@ -13,16 +13,16 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
import mock
|
||||
from oslotest import base
|
||||
from requests import auth as req_auth
|
||||
import six
|
||||
from six.moves.urllib import parse as urlparse
|
||||
|
||||
from ceilometer.network.statistics.opendaylight import client
|
||||
from ceilometer.openstack.common.gettextutils import _
|
||||
from ceilometer.openstack.common import test
|
||||
|
||||
|
||||
class TestClientHTTPBasicAuth(test.BaseTestCase):
|
||||
class TestClientHTTPBasicAuth(base.BaseTestCase):
|
||||
|
||||
auth_way = 'basic'
|
||||
scheme = 'http'
|
||||
|
@ -15,16 +15,16 @@
|
||||
import abc
|
||||
|
||||
import mock
|
||||
from oslotest import base
|
||||
import six
|
||||
from six import moves
|
||||
from six.moves.urllib import parse as url_parse
|
||||
|
||||
from ceilometer.network.statistics.opendaylight import driver
|
||||
from ceilometer.openstack.common import test
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class _Base(test.BaseTestCase):
|
||||
class _Base(base.BaseTestCase):
|
||||
|
||||
@abc.abstractproperty
|
||||
def flow_data(self):
|
||||
|
@ -12,12 +12,12 @@
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
from oslotest import base
|
||||
|
||||
from ceilometer.network.statistics import driver
|
||||
from ceilometer.openstack.common import test
|
||||
|
||||
|
||||
class TestDriver(test.BaseTestCase):
|
||||
class TestDriver(base.BaseTestCase):
|
||||
|
||||
def test_driver_ok(self):
|
||||
|
||||
|
@ -15,14 +15,15 @@
|
||||
|
||||
import datetime
|
||||
|
||||
from oslotest import base
|
||||
|
||||
from ceilometer.network import statistics
|
||||
from ceilometer.network.statistics import driver
|
||||
from ceilometer.openstack.common import test
|
||||
from ceilometer.openstack.common import timeutils
|
||||
from ceilometer import sample
|
||||
|
||||
|
||||
class TestBase(test.BaseTestCase):
|
||||
class TestBase(base.BaseTestCase):
|
||||
|
||||
def test_subclass_ok(self):
|
||||
|
||||
@ -59,7 +60,7 @@ class TestBase(test.BaseTestCase):
|
||||
self.assertRaises(TypeError, NgSubclass3)
|
||||
|
||||
|
||||
class TestBaseGetSamples(test.BaseTestCase):
|
||||
class TestBaseGetSamples(base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestBaseGetSamples, self).setUp()
|
||||
|
@ -20,14 +20,14 @@
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from oslotest import base
|
||||
|
||||
from ceilometer.central import manager
|
||||
from ceilometer.network import floatingip
|
||||
from ceilometer.openstack.common import context
|
||||
from ceilometer.openstack.common import test
|
||||
|
||||
|
||||
class TestFloatingIPPollster(test.BaseTestCase):
|
||||
class TestFloatingIPPollster(base.BaseTestCase):
|
||||
|
||||
@mock.patch('ceilometer.pipeline.setup_pipeline', mock.MagicMock())
|
||||
def setUp(self):
|
||||
|
@ -20,13 +20,13 @@ import collections
|
||||
|
||||
from keystoneclient import exceptions
|
||||
import mock
|
||||
from oslotest import base
|
||||
from oslotest import mockpatch
|
||||
from swiftclient import client as swift_client
|
||||
import testscenarios.testcase
|
||||
|
||||
from ceilometer.central import manager
|
||||
from ceilometer.objectstore import swift
|
||||
from ceilometer.openstack.common.fixture import mockpatch
|
||||
from ceilometer.openstack.common import test
|
||||
|
||||
HEAD_ACCOUNTS = [('tenant-000', {'x-account-object-count': 12,
|
||||
'x-account-bytes-used': 321321321,
|
||||
@ -62,7 +62,7 @@ class TestManager(manager.AgentManager):
|
||||
|
||||
|
||||
class TestSwiftPollster(testscenarios.testcase.WithScenarios,
|
||||
test.BaseTestCase):
|
||||
base.BaseTestCase):
|
||||
|
||||
# Define scenarios to run all of the tests against all of the
|
||||
# pollsters.
|
||||
|
@ -17,11 +17,11 @@
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from oslo.config import fixture as fixture_config
|
||||
from oslotest import mockpatch
|
||||
import six
|
||||
|
||||
from ceilometer.objectstore import swift_middleware
|
||||
from ceilometer.openstack.common.fixture import config
|
||||
from ceilometer.openstack.common.fixture import mockpatch
|
||||
from ceilometer import pipeline
|
||||
from ceilometer.tests import base as tests_base
|
||||
|
||||
@ -90,7 +90,7 @@ class TestSwiftMiddleware(tests_base.BaseTestCase):
|
||||
self.useFixture(mockpatch.PatchObject(
|
||||
pipeline, 'setup_pipeline',
|
||||
side_effect=self._fake_setup_pipeline))
|
||||
self.CONF = self.useFixture(config.Config()).conf
|
||||
self.CONF = self.useFixture(fixture_config.Config()).conf
|
||||
self.setup_messaging(self.CONF)
|
||||
|
||||
@staticmethod
|
||||
|
@ -16,9 +16,9 @@ import datetime
|
||||
|
||||
import mock
|
||||
from oslo.config import cfg
|
||||
from oslotest import base
|
||||
|
||||
from ceilometer.openstack.common import log
|
||||
from ceilometer.openstack.common import test
|
||||
from ceilometer.orchestration import notifications
|
||||
from ceilometer import sample
|
||||
|
||||
@ -88,7 +88,7 @@ def stack_notification_for(operation, use_trust=None):
|
||||
}
|
||||
|
||||
|
||||
class TestNotification(test.BaseTestCase):
|
||||
class TestNotification(base.BaseTestCase):
|
||||
|
||||
def _verify_common_sample(self, s, name, volume):
|
||||
self.assertIsNotNone(s)
|
||||
|
@ -22,11 +22,11 @@ import datetime
|
||||
import traceback
|
||||
|
||||
import mock
|
||||
from oslotest import base
|
||||
from oslotest import mockpatch
|
||||
import six
|
||||
from stevedore import extension
|
||||
|
||||
from ceilometer.openstack.common.fixture import mockpatch
|
||||
from ceilometer.openstack.common import test
|
||||
from ceilometer.openstack.common import timeutils
|
||||
from ceilometer import pipeline
|
||||
from ceilometer import publisher
|
||||
@ -39,7 +39,7 @@ from ceilometer.transformer import conversions
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class BasePipelineTestCase(test.BaseTestCase):
|
||||
class BasePipelineTestCase(base.BaseTestCase):
|
||||
def fake_tem_init(self):
|
||||
"""Fake a transformerManager for pipeline.
|
||||
|
||||
|
@ -12,8 +12,8 @@
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
from oslotest import base
|
||||
|
||||
from ceilometer.openstack.common import test
|
||||
from ceilometer.profiler import notifications
|
||||
from ceilometer import sample
|
||||
|
||||
@ -39,7 +39,7 @@ NOTIFICATION = {
|
||||
}
|
||||
|
||||
|
||||
class ProfilerNotificationsTestCase(test.BaseTestCase):
|
||||
class ProfilerNotificationsTestCase(base.BaseTestCase):
|
||||
|
||||
def test_process_notification(self):
|
||||
prof = notifications.ProfilerNotifications(None)
|
||||
|
@ -22,13 +22,14 @@ import logging.handlers
|
||||
import os
|
||||
import tempfile
|
||||
|
||||
from oslotest import base
|
||||
|
||||
from ceilometer.openstack.common import network_utils as utils
|
||||
from ceilometer.openstack.common import test
|
||||
from ceilometer.publisher import file
|
||||
from ceilometer import sample
|
||||
|
||||
|
||||
class TestFilePublisher(test.BaseTestCase):
|
||||
class TestFilePublisher(base.BaseTestCase):
|
||||
|
||||
test_data = [
|
||||
sample.Sample(
|
||||
|
@ -21,12 +21,12 @@ import datetime
|
||||
|
||||
import eventlet
|
||||
import mock
|
||||
from oslo.config import fixture as fixture_config
|
||||
import oslo.messaging
|
||||
import oslo.messaging._drivers.common
|
||||
|
||||
from ceilometer import messaging
|
||||
from ceilometer.openstack.common import context
|
||||
from ceilometer.openstack.common.fixture import config
|
||||
from ceilometer.openstack.common import network_utils
|
||||
from ceilometer.publisher import rpc
|
||||
from ceilometer import sample
|
||||
@ -94,7 +94,7 @@ class TestPublish(tests_base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestPublish, self).setUp()
|
||||
self.CONF = self.useFixture(config.Config()).conf
|
||||
self.CONF = self.useFixture(fixture_config.Config()).conf
|
||||
self.setup_messaging(self.CONF)
|
||||
self.published = []
|
||||
|
||||
|
@ -21,10 +21,10 @@ import datetime
|
||||
|
||||
import mock
|
||||
import msgpack
|
||||
from oslo.config import fixture as fixture_config
|
||||
from oslotest import base
|
||||
|
||||
from ceilometer.openstack.common.fixture import config
|
||||
from ceilometer.openstack.common import network_utils
|
||||
from ceilometer.openstack.common import test
|
||||
from ceilometer.publisher import udp
|
||||
from ceilometer.publisher import utils
|
||||
from ceilometer import sample
|
||||
@ -33,7 +33,7 @@ from ceilometer import sample
|
||||
COUNTER_SOURCE = 'testsource'
|
||||
|
||||
|
||||
class TestUDPPublisher(test.BaseTestCase):
|
||||
class TestUDPPublisher(base.BaseTestCase):
|
||||
test_data = [
|
||||
sample.Sample(
|
||||
name='test',
|
||||
@ -110,7 +110,7 @@ class TestUDPPublisher(test.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestUDPPublisher, self).setUp()
|
||||
self.CONF = self.useFixture(config.Config()).conf
|
||||
self.CONF = self.useFixture(fixture_config.Config()).conf
|
||||
self.CONF.publisher.metering_secret = 'not-so-secret'
|
||||
|
||||
def test_published(self):
|
||||
|
@ -18,13 +18,13 @@
|
||||
# under the License.
|
||||
"""Tests for ceilometer/publisher/utils.py
|
||||
"""
|
||||
from oslotest import base
|
||||
|
||||
from ceilometer.openstack.common import jsonutils
|
||||
from ceilometer.openstack.common import test
|
||||
from ceilometer.publisher import utils
|
||||
|
||||
|
||||
class TestSignature(test.BaseTestCase):
|
||||
class TestSignature(base.BaseTestCase):
|
||||
def test_compute_signature_change_key(self):
|
||||
sig1 = utils.compute_signature({'a': 'A', 'b': 'B'},
|
||||
'not-so-secret')
|
||||
|
@ -18,16 +18,16 @@
|
||||
import datetime
|
||||
|
||||
import mock
|
||||
from oslotest import base
|
||||
import sqlalchemy
|
||||
from sqlalchemy.dialects.mysql import DECIMAL
|
||||
from sqlalchemy.types import NUMERIC
|
||||
|
||||
from ceilometer.openstack.common import test
|
||||
from ceilometer.storage.sqlalchemy import models
|
||||
from ceilometer import utils
|
||||
|
||||
|
||||
class PreciseTimestampTest(test.BaseTestCase):
|
||||
class PreciseTimestampTest(base.BaseTestCase):
|
||||
|
||||
@staticmethod
|
||||
def fake_dialect(name):
|
||||
|
@ -17,11 +17,12 @@
|
||||
import datetime
|
||||
import math
|
||||
|
||||
from ceilometer.openstack.common import test
|
||||
from oslotest import base as testbase
|
||||
|
||||
from ceilometer.storage import base
|
||||
|
||||
|
||||
class BaseTest(test.BaseTestCase):
|
||||
class BaseTest(testbase.BaseTestCase):
|
||||
|
||||
def test_iter_period(self):
|
||||
times = list(base.iter_period(
|
||||
|
@ -16,11 +16,11 @@
|
||||
# under the License.
|
||||
"""Tests for ceilometer/storage/
|
||||
"""
|
||||
from oslo.config import fixture as fixture_config
|
||||
from oslotest import base
|
||||
|
||||
from ceilometer.alarm.storage import impl_log as impl_log_alarm
|
||||
from ceilometer.alarm.storage import impl_sqlalchemy as impl_sqlalchemy_alarm
|
||||
from ceilometer.openstack.common.fixture import config
|
||||
from ceilometer.openstack.common import test
|
||||
from ceilometer import storage
|
||||
from ceilometer.storage import impl_log
|
||||
from ceilometer.storage import impl_sqlalchemy
|
||||
@ -28,7 +28,7 @@ from ceilometer.storage import impl_sqlalchemy
|
||||
import six
|
||||
|
||||
|
||||
class EngineTest(test.BaseTestCase):
|
||||
class EngineTest(base.BaseTestCase):
|
||||
|
||||
def test_get_connection(self):
|
||||
engine = storage.get_connection('log://localhost',
|
||||
@ -43,10 +43,10 @@ class EngineTest(test.BaseTestCase):
|
||||
self.assertIn('no-such-engine', six.text_type(err))
|
||||
|
||||
|
||||
class ConnectionConfigTest(test.BaseTestCase):
|
||||
class ConnectionConfigTest(base.BaseTestCase):
|
||||
def setUp(self):
|
||||
super(ConnectionConfigTest, self).setUp()
|
||||
self.CONF = self.useFixture(config.Config()).conf
|
||||
self.CONF = self.useFixture(fixture_config.Config()).conf
|
||||
|
||||
def test_only_default_url(self):
|
||||
self.CONF.set_override("connection", "log://", group="database")
|
||||
|
@ -16,12 +16,12 @@
|
||||
# under the License.
|
||||
"""Tests for ceilometer/storage/impl_log.py
|
||||
"""
|
||||
from oslotest import base
|
||||
|
||||
from ceilometer.openstack.common import test
|
||||
from ceilometer.storage import impl_log
|
||||
|
||||
|
||||
class ConnectionTest(test.BaseTestCase):
|
||||
class ConnectionTest(base.BaseTestCase):
|
||||
def test_get_connection(self):
|
||||
conn = impl_log.Connection(None)
|
||||
conn.record_metering_data({'counter_name': 'test',
|
||||
|
@ -17,8 +17,9 @@
|
||||
|
||||
import datetime
|
||||
|
||||
from oslotest import base as testbase
|
||||
|
||||
from ceilometer.alarm.storage import models as alarm_models
|
||||
from ceilometer.openstack.common import test
|
||||
from ceilometer.storage import base
|
||||
from ceilometer.storage import models
|
||||
|
||||
@ -28,7 +29,7 @@ class FakeModel(base.Model):
|
||||
base.Model.__init__(self, arg1=arg1, arg2=arg2)
|
||||
|
||||
|
||||
class ModelTest(test.BaseTestCase):
|
||||
class ModelTest(testbase.BaseTestCase):
|
||||
|
||||
def test_create_attributes(self):
|
||||
m = FakeModel(1, 2)
|
||||
@ -89,7 +90,7 @@ class ModelTest(test.BaseTestCase):
|
||||
set(alarm_models.AlarmChange.get_field_names()))
|
||||
|
||||
|
||||
class TestTraitModel(test.BaseTestCase):
|
||||
class TestTraitModel(testbase.BaseTestCase):
|
||||
|
||||
def test_convert_value(self):
|
||||
v = models.Trait.convert_value(
|
||||
|
@ -19,15 +19,15 @@ import socket
|
||||
|
||||
import mock
|
||||
import msgpack
|
||||
from oslo.config import fixture as fixture_config
|
||||
import oslo.messaging
|
||||
from oslotest import mockpatch
|
||||
from stevedore import extension
|
||||
|
||||
from ceilometer import collector
|
||||
from ceilometer import dispatcher
|
||||
from ceilometer import messaging
|
||||
from ceilometer.openstack.common import context
|
||||
from ceilometer.openstack.common.fixture import config
|
||||
from ceilometer.openstack.common.fixture import mockpatch
|
||||
from ceilometer.openstack.common import timeutils
|
||||
from ceilometer.publisher import utils
|
||||
from ceilometer import sample
|
||||
@ -42,7 +42,7 @@ class FakeConnection():
|
||||
class TestCollector(tests_base.BaseTestCase):
|
||||
def setUp(self):
|
||||
super(TestCollector, self).setUp()
|
||||
self.CONF = self.useFixture(config.Config()).conf
|
||||
self.CONF = self.useFixture(fixture_config.Config()).conf
|
||||
self.CONF.import_opt("connection",
|
||||
"ceilometer.openstack.common.db.options",
|
||||
group="database")
|
||||
|
@ -13,18 +13,17 @@
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from oslo.config import fixture as fixture_config
|
||||
import oslo.messaging
|
||||
from oslotest import base
|
||||
|
||||
from ceilometer import messaging
|
||||
from ceilometer.openstack.common.fixture import config
|
||||
from ceilometer.openstack.common import test
|
||||
|
||||
|
||||
class MessagingTests(test.BaseTestCase):
|
||||
class MessagingTests(base.BaseTestCase):
|
||||
def setUp(self):
|
||||
super(MessagingTests, self).setUp()
|
||||
self.CONF = self.useFixture(config.Config()).conf
|
||||
self.CONF = self.useFixture(fixture_config.Config()).conf
|
||||
self.useFixture(oslo.messaging.conffixture.ConfFixture(self.CONF))
|
||||
|
||||
def test_get_transport_invalid_url(self):
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright 2013 eNovance
|
||||
# Copyright 2013-2014 eNovance
|
||||
#
|
||||
# Author: Julien Danjou <julien@danjou.info>
|
||||
#
|
||||
@ -14,11 +14,10 @@
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from oslo.config import fixture as fixture_config
|
||||
|
||||
from ceilometer import middleware
|
||||
from ceilometer.openstack.common.fixture import config
|
||||
from ceilometer.tests import base
|
||||
|
||||
|
||||
@ -72,7 +71,7 @@ class TestNotifications(base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestNotifications, self).setUp()
|
||||
self.CONF = self.useFixture(config.Config()).conf
|
||||
self.CONF = self.useFixture(fixture_config.Config()).conf
|
||||
self.setup_messaging(self.CONF)
|
||||
|
||||
def test_process_request_notification(self):
|
||||
|
@ -15,12 +15,12 @@
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from oslotest import base
|
||||
|
||||
from ceilometer import neutron_client
|
||||
from ceilometer.openstack.common import test
|
||||
|
||||
|
||||
class TestNeutronClient(test.BaseTestCase):
|
||||
class TestNeutronClient(base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestNeutronClient, self).setUp()
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
import eventlet
|
||||
import mock
|
||||
from oslo.config import fixture as fixture_config
|
||||
import oslo.messaging
|
||||
import oslo.messaging.conffixture
|
||||
from stevedore import extension
|
||||
@ -28,7 +29,6 @@ from ceilometer import messaging
|
||||
from ceilometer import notification
|
||||
from ceilometer.openstack.common import context
|
||||
from ceilometer.openstack.common import fileutils
|
||||
from ceilometer.openstack.common.fixture import config
|
||||
from ceilometer.openstack.common import timeutils
|
||||
from ceilometer.publisher import test as test_publisher
|
||||
from ceilometer.tests import base as tests_base
|
||||
@ -89,7 +89,7 @@ class TestNotification(tests_base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestNotification, self).setUp()
|
||||
self.CONF = self.useFixture(config.Config()).conf
|
||||
self.CONF = self.useFixture(fixture_config.Config()).conf
|
||||
self.CONF.set_override("connection", "log://", group='database')
|
||||
self.CONF.set_override("store_events", False, group="notification")
|
||||
self.setup_messaging(self.CONF)
|
||||
@ -167,7 +167,7 @@ class TestNotification(tests_base.BaseTestCase):
|
||||
class TestRealNotification(tests_base.BaseTestCase):
|
||||
def setUp(self):
|
||||
super(TestRealNotification, self).setUp()
|
||||
self.CONF = self.useFixture(config.Config()).conf
|
||||
self.CONF = self.useFixture(fixture_config.Config()).conf
|
||||
self.setup_messaging(self.CONF, 'nova')
|
||||
|
||||
pipeline = yaml.dump([{
|
||||
|
@ -16,9 +16,9 @@
|
||||
# under the License.
|
||||
"""Tests for ceilometer/notifier.py
|
||||
"""
|
||||
from oslotest import base
|
||||
|
||||
from ceilometer import notifier
|
||||
from ceilometer.openstack.common import test
|
||||
from ceilometer import pipeline
|
||||
from ceilometer import transformer
|
||||
|
||||
@ -63,7 +63,7 @@ MESSAGE = {
|
||||
}
|
||||
|
||||
|
||||
class TestNotifier(test.BaseTestCase):
|
||||
class TestNotifier(base.BaseTestCase):
|
||||
|
||||
def test_process_notification(self):
|
||||
transformer_manager = transformer.TransformerExtensionManager(
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# Copyright 2013 eNovance <licensing@enovance.com>
|
||||
# Copyright 2013-2014 eNovance <licensing@enovance.com>
|
||||
#
|
||||
# Author: Julien Danjou <julien@danjou.info>
|
||||
#
|
||||
@ -18,14 +18,14 @@
|
||||
|
||||
import mock
|
||||
import novaclient
|
||||
from oslo.config import fixture as fixture_config
|
||||
from oslotest import base
|
||||
from oslotest import mockpatch
|
||||
|
||||
from ceilometer import nova_client
|
||||
from ceilometer.openstack.common.fixture import config
|
||||
from ceilometer.openstack.common.fixture import mockpatch
|
||||
from ceilometer.openstack.common import test
|
||||
|
||||
|
||||
class TestNovaClient(test.BaseTestCase):
|
||||
class TestNovaClient(base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestNovaClient, self).setUp()
|
||||
@ -38,7 +38,7 @@ class TestNovaClient(test.BaseTestCase):
|
||||
self.useFixture(mockpatch.PatchObject(
|
||||
self.nv.nova_client.images, 'get',
|
||||
side_effect=self.fake_images_get))
|
||||
self.CONF = self.useFixture(config.Config()).conf
|
||||
self.CONF = self.useFixture(fixture_config.Config()).conf
|
||||
|
||||
def fake_flavors_get(self, *args, **kwargs):
|
||||
self._flavors_count += 1
|
||||
|
@ -16,9 +16,9 @@
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from oslo.config import fixture as fixture_config
|
||||
from oslotest import base
|
||||
|
||||
from ceilometer.openstack.common.fixture import config
|
||||
from ceilometer.openstack.common import test
|
||||
from ceilometer import plugin
|
||||
|
||||
|
||||
@ -72,10 +72,10 @@ TEST_NOTIFICATION = {
|
||||
}
|
||||
|
||||
|
||||
class NotificationBaseTestCase(test.BaseTestCase):
|
||||
class NotificationBaseTestCase(base.BaseTestCase):
|
||||
def setUp(self):
|
||||
super(NotificationBaseTestCase, self).setUp()
|
||||
self.CONF = self.useFixture(config.Config()).conf
|
||||
self.CONF = self.useFixture(fixture_config.Config()).conf
|
||||
|
||||
def test_handle_event_type(self):
|
||||
self.assertFalse(plugin.NotificationBase._handle_event_type(
|
||||
|
@ -21,11 +21,12 @@
|
||||
import datetime
|
||||
import decimal
|
||||
|
||||
from ceilometer.openstack.common import test
|
||||
from oslotest import base
|
||||
|
||||
from ceilometer import utils
|
||||
|
||||
|
||||
class TestUtils(test.BaseTestCase):
|
||||
class TestUtils(base.BaseTestCase):
|
||||
|
||||
def test_datetime_to_decimal(self):
|
||||
expected = 1356093296.12
|
||||
|
@ -11,8 +11,8 @@
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from oslotest import base
|
||||
|
||||
from ceilometer.openstack.common import test
|
||||
from ceilometer.volume import notifications
|
||||
|
||||
NOTIFICATION_VOLUME_EXISTS = {
|
||||
@ -187,7 +187,7 @@ NOTIFICATION_SNAPSHOT_EXISTS = {
|
||||
u'priority': u'INFO'}
|
||||
|
||||
|
||||
class TestNotifications(test.BaseTestCase):
|
||||
class TestNotifications(base.BaseTestCase):
|
||||
|
||||
def _verify_common_sample_volume(self, s, name, notification):
|
||||
self.assertIsNotNone(s)
|
||||
|
@ -22,7 +22,8 @@ import contextlib
|
||||
import datetime
|
||||
|
||||
import mock
|
||||
|
||||
from oslotest import base
|
||||
from oslotest import moxstubout
|
||||
from stevedore import extension
|
||||
|
||||
## NOTE(dhellmann): These imports are not in the generally approved
|
||||
@ -46,12 +47,6 @@ from nova.openstack.common import log as logging
|
||||
# sure it is defined.
|
||||
config.cfg.CONF.import_opt('compute_manager', 'nova.service')
|
||||
|
||||
# HACK(jd) Import this first because of the second HACK below, and because
|
||||
# of Nova not having these module yet as of this writing
|
||||
from ceilometer.openstack.common import test
|
||||
from ceilometer.openstack.common.fixture import config
|
||||
from ceilometer.openstack.common.fixture import moxstubout
|
||||
|
||||
# HACK(dhellmann): Import this before any other ceilometer code
|
||||
# because the notifier module messes with the import path to force
|
||||
# nova's version of oslo to be used instead of ceilometer's.
|
||||
@ -64,7 +59,7 @@ LOG = logging.getLogger(__name__)
|
||||
nova_CONF = config.cfg.CONF
|
||||
|
||||
|
||||
class TestNovaNotifier(test.BaseTestCase):
|
||||
class TestNovaNotifier(base.BaseTestCase):
|
||||
|
||||
class Pollster(object):
|
||||
instances = []
|
||||
|
@ -7,7 +7,6 @@ module=db
|
||||
module=db.sqlalchemy
|
||||
module=eventlet_backdoor
|
||||
module=excutils
|
||||
module=fixture
|
||||
module=gettextutils
|
||||
module=importutils
|
||||
module=jsonutils
|
||||
|
@ -10,7 +10,7 @@ lockfile>=0.8
|
||||
lxml>=2.3
|
||||
msgpack-python>=0.4.0
|
||||
netaddr>=0.7.6
|
||||
oslo.config>=1.2.1
|
||||
oslo.config>=1.4.0.0a3
|
||||
PasteDeploy>=1.5.0
|
||||
pbr>=0.6,!=0.7,<1.0
|
||||
pecan>=0.5.0
|
||||
|
@ -12,7 +12,7 @@ lockfile>=0.8
|
||||
lxml>=2.3
|
||||
msgpack-python>=0.4.0
|
||||
netaddr>=0.7.6
|
||||
oslo.config>=1.2.1
|
||||
oslo.config>=1.4.0.0a3
|
||||
oslo.vmware>=0.4 # Apache-2.0
|
||||
PasteDeploy>=1.5.0
|
||||
pbr>=0.6,!=0.7,<1.0
|
||||
|
Loading…
x
Reference in New Issue
Block a user