Do not emit ssl warnings in the test_ssl_connection test

Since python3.10 we get a warning inside the ovs.stream module:

Warnings: {message : DeprecationWarning('ssl.PROTOCOL_TLS is
deprecated'), category : 'DeprecationWarning', filename :
'python3.10/site-packages/ovs/stream.py', lineno : 794, line : None}

or using python console:

>>> ssl.SSLContext(ssl.PROTOCOL_SSLv23)
<stdin>:1: DeprecationWarning: ssl.PROTOCOL_TLS is deprecated
<ssl.SSLContext object at 0x7f98620223c0>
>>>

This patch mocks the 'Connection.run' method that emits this warning
inside a thread. This patch also fixes a failure in the
test_distributed_port_binding_deleted_by_port_deletion test that was
catching the ssl warning from test_ssl_connection and therefore
failing.

Closes-Bug: #1998343
Signed-off-by: Anton Kurbatov <Anton.Kurbatov@acronis.com>
Change-Id: I6a4b9222a63a0d0271069eb12d0c97dd3821a2cc
This commit is contained in:
Anton Kurbatov
2022-11-30 15:04:34 +00:00
parent 895f818cb3
commit 26c55efe34

View File

@@ -76,7 +76,8 @@ class ConfigureSslConnTestCase(base.BaseTestCase):
ovs_idl_monitor = self._get_ovs_idl_monitor()
conn = connection.Connection(idl=ovs_idl_monitor,
timeout=1)
conn.start()
with mock.patch.object(connection.Connection, 'run'):
conn.start()
self.mock_stream.ssl_set_private_key_file.assert_called_once_with(
SSL_KEY_FILE)
self.mock_stream.ssl_set_certificate_file.assert_called_once_with(