Monkey patch threading module as early as possible
In oslo.messaging, local thread store is used to pass RPC request context [1]. If we try to import oslo.messaging before monkey patching threading library, it attempts to access unpatched storage and fails with AttributeError. [1]: oslo/messaging/localcontext.py#L26 blueprint oslo-messaging Change-Id: Ied7302fcb1d3e14428540e39e3db704550027890
This commit is contained in:
@@ -42,12 +42,10 @@ class TestLbaasService(base.BaseTestCase):
|
||||
with contextlib.nested(
|
||||
mock.patch(logging_str),
|
||||
mock.patch.object(agent.service, 'launch'),
|
||||
mock.patch.object(agent, 'eventlet'),
|
||||
mock.patch('sys.argv'),
|
||||
mock.patch.object(agent.manager, 'LbaasAgentManager'),
|
||||
mock.patch.object(cfg.CONF, 'register_opts')
|
||||
) as (mock_logging, mock_launch, mock_eventlet, sys_argv, mgr_cls, ro):
|
||||
) as (mock_logging, mock_launch, sys_argv, mgr_cls, ro):
|
||||
agent.main()
|
||||
|
||||
self.assertTrue(mock_eventlet.monkey_patch.called)
|
||||
mock_launch.assert_called_once_with(mock.ANY)
|
||||
|
||||
Reference in New Issue
Block a user