From 0fb614046f7bede7f524f4ee85d26e3b0f087df2 Mon Sep 17 00:00:00 2001 From: Rodolfo Alonso Hernandez Date: Tue, 16 Mar 2021 15:24:53 +0000 Subject: [PATCH] [OVN][FT] Mech driver stop accessing DB at exit "OVNMechanismDriver._clean_hash_ring" is called at exit. Because the SQL connection is already closed, an exception is logged. This patch mocks this method and avoids the OVN FTs to log this message. Closes-Bug: #1919352 Change-Id: I6c68d15d0af644ab00467bea8e0cd3ca816f5cc5 (cherry picked from commit 92a4db01fefb3fe224be920abf372436b8e02c8e) --- neutron/tests/functional/base.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/neutron/tests/functional/base.py b/neutron/tests/functional/base.py index 243edd8238d..945580a6cfe 100644 --- a/neutron/tests/functional/base.py +++ b/neutron/tests/functional/base.py @@ -314,6 +314,9 @@ class TestOVNFunctionalBase(test_plugin.Ml2PluginV2TestCase, trigger_cls.trigger.__self__.__class__ = neutron.wsgi.WorkerService self.addCleanup(self.stop) + # NOTE(ralonsoh): do not access to the DB at exit when the SQL + # connection is already closed, to avoid useless exception messages. + mock.patch.object(self.mech_driver, '_clean_hash_ring').start() self.mech_driver.pre_fork_initialize( mock.ANY, mock.ANY, trigger_cls.trigger)