Merge "Use messaging_conf fixture configuration by default"
This commit is contained in:
commit
19053b6e65
@ -52,6 +52,8 @@ class ConfFixture(fixtures.Fixture):
|
||||
'oslo.messaging._drivers.amqp', 'amqp_opts')
|
||||
_import_opts(self.conf, 'oslo.messaging.rpc.client', '_client_opts')
|
||||
_import_opts(self.conf, 'oslo.messaging.transport', '_transport_opts')
|
||||
_import_opts(self.conf,
|
||||
'oslo.messaging.notify.notifier', '_notifier_opts')
|
||||
|
||||
def setUp(self):
|
||||
super(ConfFixture, self).setUp()
|
||||
|
@ -23,7 +23,6 @@ class PublishErrorsHandlerTestCase(test_utils.BaseTestCase):
|
||||
"""Tests for log.PublishErrorsHandler"""
|
||||
def setUp(self):
|
||||
super(PublishErrorsHandlerTestCase, self).setUp()
|
||||
self.conf.register_opts(messaging.notify.notifier._notifier_opts)
|
||||
self.publisherrorshandler = (log_handler.
|
||||
PublishErrorsHandler(logging.ERROR))
|
||||
|
||||
|
@ -135,8 +135,6 @@ class TestMessagingNotifier(test_utils.BaseTestCase):
|
||||
def setUp(self):
|
||||
super(TestMessagingNotifier, self).setUp()
|
||||
|
||||
self.conf.register_opts(msg_notifier._notifier_opts)
|
||||
|
||||
self.logger = self.useFixture(_ReRaiseLoggedExceptionsFixture()).logger
|
||||
self.stubs.Set(_impl_messaging, 'LOG', self.logger)
|
||||
self.stubs.Set(msg_notifier, '_LOG', self.logger)
|
||||
@ -149,8 +147,8 @@ class TestMessagingNotifier(test_utils.BaseTestCase):
|
||||
if self.v2:
|
||||
drivers.append('messagingv2')
|
||||
|
||||
self.config(notification_driver=drivers)
|
||||
self.config(notification_topics=self.topics)
|
||||
self.config(notification_driver=drivers,
|
||||
notification_topics=self.topics)
|
||||
|
||||
transport = _FakeTransport(self.conf)
|
||||
|
||||
@ -251,10 +249,6 @@ class TestSerializer(test_utils.BaseTestCase):
|
||||
|
||||
class TestLogNotifier(test_utils.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestLogNotifier, self).setUp()
|
||||
self.conf.register_opts(msg_notifier._notifier_opts)
|
||||
|
||||
@mock.patch('oslo.messaging.openstack.common.timeutils.utcnow')
|
||||
def test_notifier(self, mock_utcnow):
|
||||
self.config(notification_driver=['log'])
|
||||
|
@ -128,11 +128,11 @@ class TestQpidInvalidTopologyVersion(_QpidBaseTestCase):
|
||||
# 1. qpid driver raises Exception(msg) for invalid topology version
|
||||
# 2. flake8 - H202 assertRaises Exception too broad
|
||||
exception_msg = ("Invalid value for qpid_topology_version: %d" %
|
||||
self.messaging_conf.conf.qpid_topology_version)
|
||||
self.conf.qpid_topology_version)
|
||||
recvd_exc_msg = ''
|
||||
|
||||
try:
|
||||
self.consumer_cls(self.messaging_conf.conf,
|
||||
self.consumer_cls(self.conf,
|
||||
self.session_receive,
|
||||
msgid_or_topic,
|
||||
consumer_callback)
|
||||
@ -143,7 +143,7 @@ class TestQpidInvalidTopologyVersion(_QpidBaseTestCase):
|
||||
|
||||
recvd_exc_msg = ''
|
||||
try:
|
||||
self.publisher_cls(self.messaging_conf.conf,
|
||||
self.publisher_cls(self.conf,
|
||||
self.session_send,
|
||||
msgid_or_topic)
|
||||
except Exception as e:
|
||||
@ -185,11 +185,11 @@ class TestQpidDirectConsumerPublisher(_QpidBaseTestCase):
|
||||
self.msgid = str(random.randint(1, 100))
|
||||
|
||||
# create a DirectConsumer and DirectPublisher class objects
|
||||
self.dir_cons = qpid_driver.DirectConsumer(self.messaging_conf.conf,
|
||||
self.dir_cons = qpid_driver.DirectConsumer(self.conf,
|
||||
self.session_receive,
|
||||
self.msgid,
|
||||
self.consumer_callback)
|
||||
self.dir_pub = qpid_driver.DirectPublisher(self.messaging_conf.conf,
|
||||
self.dir_pub = qpid_driver.DirectPublisher(self.conf,
|
||||
self.session_send,
|
||||
self.msgid)
|
||||
|
||||
@ -341,7 +341,7 @@ class TestQpidTopicAndFanout(_QpidBaseTestCase):
|
||||
|
||||
def test_qpid_topic_and_fanout(self):
|
||||
for receiver_id in range(self.no_receivers):
|
||||
consumer = self.consumer_cls(self.messaging_conf.conf,
|
||||
consumer = self.consumer_cls(self.conf,
|
||||
self.session_receive,
|
||||
self.receive_topic,
|
||||
self.consumer_callback)
|
||||
@ -353,7 +353,7 @@ class TestQpidTopicAndFanout(_QpidBaseTestCase):
|
||||
self._receiver_threads.append(thread)
|
||||
|
||||
for sender_id in range(self.no_senders):
|
||||
publisher = self.publisher_cls(self.messaging_conf.conf,
|
||||
publisher = self.publisher_cls(self.conf,
|
||||
self.session_send,
|
||||
self.topic)
|
||||
self._senders.append(publisher)
|
||||
|
@ -17,7 +17,6 @@ from oslo.config import cfg
|
||||
import testscenarios
|
||||
|
||||
from oslo import messaging
|
||||
from oslo.messaging.rpc import client as rpc_client
|
||||
from oslo.messaging import serializer as msg_serializer
|
||||
from tests import utils as test_utils
|
||||
|
||||
@ -48,10 +47,6 @@ class TestCastCall(test_utils.BaseTestCase):
|
||||
args=dict(bar='blaa', foobar=11.01))),
|
||||
]
|
||||
|
||||
def setUp(self):
|
||||
super(TestCastCall, self).setUp(conf=cfg.ConfigOpts())
|
||||
self.conf.register_opts(rpc_client._client_opts)
|
||||
|
||||
def test_cast_call(self):
|
||||
self.config(rpc_response_timeout=None)
|
||||
|
||||
@ -238,10 +233,6 @@ class TestCallTimeout(test_utils.BaseTestCase):
|
||||
dict(confval=None, ctor=None, prepare=0, expect=0)),
|
||||
]
|
||||
|
||||
def setUp(self):
|
||||
super(TestCallTimeout, self).setUp(conf=cfg.ConfigOpts())
|
||||
self.conf.register_opts(rpc_client._client_opts)
|
||||
|
||||
def test_call_timeout(self):
|
||||
self.config(rpc_response_timeout=self.confval)
|
||||
|
||||
@ -277,10 +268,6 @@ class TestSerializer(test_utils.BaseTestCase):
|
||||
retval='d')),
|
||||
]
|
||||
|
||||
def setUp(self):
|
||||
super(TestSerializer, self).setUp(conf=cfg.ConfigOpts())
|
||||
self.conf.register_opts(rpc_client._client_opts)
|
||||
|
||||
def test_call_serializer(self):
|
||||
self.config(rpc_response_timeout=None)
|
||||
|
||||
@ -361,10 +348,6 @@ class TestVersionCap(test_utils.BaseTestCase):
|
||||
testscenarios.multiply_scenarios(cls._call_vs_cast,
|
||||
cls._cap_scenarios))
|
||||
|
||||
def setUp(self):
|
||||
super(TestVersionCap, self).setUp(conf=cfg.ConfigOpts())
|
||||
self.conf.register_opts(rpc_client._client_opts)
|
||||
|
||||
def test_version_cap(self):
|
||||
self.config(rpc_response_timeout=None)
|
||||
|
||||
@ -459,10 +442,6 @@ class TestCanSendVersion(test_utils.BaseTestCase):
|
||||
can_send=False)),
|
||||
]
|
||||
|
||||
def setUp(self):
|
||||
super(TestCanSendVersion, self).setUp(conf=cfg.ConfigOpts())
|
||||
self.conf.register_opts(rpc_client._client_opts)
|
||||
|
||||
def test_version_cap(self):
|
||||
self.config(rpc_response_timeout=None)
|
||||
|
||||
|
@ -112,10 +112,6 @@ class GetTransportTestCase(test_utils.BaseTestCase):
|
||||
allowed=[]))),
|
||||
]
|
||||
|
||||
def setUp(self):
|
||||
super(GetTransportTestCase, self).setUp(conf=cfg.ConfigOpts())
|
||||
self.conf.register_opts(transport._transport_opts)
|
||||
|
||||
def test_get_transport(self):
|
||||
self.config(rpc_backend=self.rpc_backend,
|
||||
control_exchange=self.control_exchange,
|
||||
@ -171,10 +167,6 @@ class GetTransportSadPathTestCase(test_utils.BaseTestCase):
|
||||
driver='testbackend'))),
|
||||
]
|
||||
|
||||
def setUp(self):
|
||||
super(GetTransportSadPathTestCase, self).setUp(conf=cfg.ConfigOpts())
|
||||
self.conf.register_opts(transport._transport_opts)
|
||||
|
||||
def test_get_transport_sad(self):
|
||||
self.config(rpc_backend=self.rpc_backend,
|
||||
transport_url=self.transport_url)
|
||||
|
@ -13,11 +13,9 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from oslo.config import cfg
|
||||
import testscenarios
|
||||
|
||||
from oslo import messaging
|
||||
from oslo.messaging import transport
|
||||
from tests import utils as test_utils
|
||||
|
||||
load_tests = testscenarios.load_tests_apply_scenarios
|
||||
@ -120,10 +118,6 @@ class TestParseURL(test_utils.BaseTestCase):
|
||||
]))),
|
||||
]
|
||||
|
||||
def setUp(self):
|
||||
super(TestParseURL, self).setUp(conf=cfg.ConfigOpts())
|
||||
self.conf.register_opts(transport._transport_opts)
|
||||
|
||||
def test_parse_url(self):
|
||||
self.config(rpc_backend=None)
|
||||
|
||||
@ -223,10 +217,6 @@ class TestFormatURL(test_utils.BaseTestCase):
|
||||
expected='testtransport://b%24:s%26@host:10//%24')),
|
||||
]
|
||||
|
||||
def setUp(self):
|
||||
super(TestFormatURL, self).setUp(conf=cfg.ConfigOpts())
|
||||
self.conf.register_opts(transport._transport_opts)
|
||||
|
||||
def test_parse_url(self):
|
||||
self.config(rpc_backend=self.rpc_backend)
|
||||
|
||||
|
@ -32,12 +32,10 @@ class BaseTestCase(base.BaseTestCase):
|
||||
|
||||
def setUp(self, conf=cfg.CONF):
|
||||
super(BaseTestCase, self).setUp()
|
||||
self.conf = conf
|
||||
self.addCleanup(self.conf.reset)
|
||||
|
||||
from oslo.messaging import conffixture
|
||||
self.messaging_conf = self.useFixture(
|
||||
conffixture.ConfFixture(self.conf))
|
||||
self.messaging_conf = self.useFixture(conffixture.ConfFixture(conf))
|
||||
self.conf = self.messaging_conf.conf
|
||||
|
||||
moxfixture = self.useFixture(moxstubout.MoxStubout())
|
||||
self.mox = moxfixture.mox
|
||||
|
Loading…
Reference in New Issue
Block a user