From a03a60e89deefc12153c31229e00a77a58525f45 Mon Sep 17 00:00:00 2001 From: yatinkarel Date: Mon, 26 Jun 2023 17:52:36 +0530 Subject: [PATCH] Disable pool recycle in tests The default for connection_recycle_time is one hour. If any test using StaticSqlFixture runs after 1 hour it fails as connection get's recycled. With sqlite memory db if there is a connection disconnect or reconnect db get's wiped off. This patch disables the pool recycle so tests can run fine even in slow environments. Closes-Bug: #2024674 Change-Id: I04f120d3ccd11b18ae08cb10b19a7cb5a0e8983d (cherry picked from commit 576c468b711a94a1e6a7d5c65841b6a042dab855) --- neutron/tests/base.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/neutron/tests/base.py b/neutron/tests/base.py index 6640fe245b0..5e4b8fed7d1 100644 --- a/neutron/tests/base.py +++ b/neutron/tests/base.py @@ -253,6 +253,10 @@ def setUp(self): # for more info. db_options.set_defaults(cfg.CONF, connection='sqlite://') + # NOTE(ykarel): Disable pool recycle as tables are dropped with sqlite + # memory db with connection close or reconnect + cfg.CONF.set_override('connection_recycle_time', -1, group='database') + # Configure this first to ensure pm debugging support for setUp() debugger = os.environ.get('OS_POST_MORTEM_DEBUGGER') if debugger: