From 76e277ba032ef6e070dd4d1937c7dd2bd715bc7e Mon Sep 17 00:00:00 2001 From: Julia Kreger Date: Mon, 20 Feb 2023 11:11:08 -0800 Subject: [PATCH] [zed-only] Fix functional tests stable/zed was failing for the python-ironic-inspector-client functional testing, which relied upon a sqllite database. The inherent issue here is oslo.db 12.1.0 is available for stable/zed, which disabled autocommit by default for compatability with SQLAlchemy 2.0. While one would think existing code in the branch would cover this, the actual assertion of autocmmit needs to be done as early as possible, so in this change we attempt to assert it before any database access is started, which should allow stable/zed functional testing to work. This is not required on later branches as ironic-inspector's code was updated during the Antelope development cycle to support SQLAlchemy 2.0. Change-Id: I25bab2041e9d5b985a8978c5a32d4e46a0986e4a --- ironic_inspector/test/functional.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ironic_inspector/test/functional.py b/ironic_inspector/test/functional.py index 9498a81b8..7e2f04cb1 100644 --- a/ironic_inspector/test/functional.py +++ b/ironic_inspector/test/functional.py @@ -28,6 +28,7 @@ import eventlet import fixtures from oslo_config import cfg from oslo_config import fixture as config_fixture +from oslo_db.sqlalchemy import enginefacade from oslo_utils import timeutils from oslo_utils import uuidutils import pytz @@ -107,6 +108,10 @@ class Base(base.NodeTest): ROOT_URL = 'http://127.0.0.1:5050' IS_FUNCTIONAL = True + # NOTE(TheJulia): Pre-configure the engine so we're compatible with + # oslo.db 12.1.0 for functional tests. + enginefacade.configure(sqlite_fk=False, __autocommit=True) + def setUp(self): super(Base, self).setUp() rules.delete_all()