[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
Julia Kreger 2023-02-20 11:11:08 -08:00
parent e1932cd86b
commit 76e277ba03
1 changed files with 5 additions and 0 deletions

View File

@ -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):
# 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()