Mock threading.Thread to prevent daemon creation by unit tests
tests.unit.agent.ovsdb.native.test_connection.TestOVSNativeConnection calls Connection.start() which starts a daemon with a while True loop full of mocks. mock._CallList of those mocks start to grow very quick and finally eat all available memory. Closes-Bug: #1595878 Change-Id: Ie053a2248925ce5bb960207c16c23b261d1d458c
This commit is contained in:
parent
080bf68895
commit
a5d19b41a5
|
@ -36,7 +36,8 @@ class TestOVSNativeConnection(base.BaseTestCase):
|
|||
gsh.return_value = helper = mock.Mock()
|
||||
self.connection = connection.Connection(
|
||||
mock.Mock(), mock.Mock(), mock.Mock())
|
||||
with mock.patch.object(poller, 'Poller') as poller_mock:
|
||||
with mock.patch.object(poller, 'Poller') as poller_mock,\
|
||||
mock.patch('threading.Thread'):
|
||||
poller_mock.return_value.block.side_effect = eventlet.sleep
|
||||
self.connection.start(table_name_list=table_name_list)
|
||||
reg_all_called = table_name_list is None
|
||||
|
|
Loading…
Reference in New Issue