Merge "Use specific element to detect database backend"
This commit is contained in:
commit
9d791077a3
@ -97,7 +97,7 @@ class Checks(upgradecheck.UpgradeCommands):
|
||||
def _check_allocations_table(self):
|
||||
msg = None
|
||||
engine = enginefacade.reader.get_engine()
|
||||
if 'mysql' not in str(engine.url):
|
||||
if 'mysql' != str(engine.url.get_backend_name()):
|
||||
# This test only applies to mysql and database schema
|
||||
# selection.
|
||||
return upgradecheck.Result(upgradecheck.Code.SUCCESS)
|
||||
|
@ -16,6 +16,7 @@ from unittest import mock
|
||||
|
||||
from oslo_db import sqlalchemy
|
||||
from oslo_upgradecheck.upgradecheck import Code
|
||||
from sqlalchemy.engine import url as sa_url
|
||||
|
||||
from ironic.cmd import dbsync
|
||||
from ironic.cmd import status
|
||||
@ -60,7 +61,8 @@ class TestUpgradeChecks(db_base.DbTestCase):
|
||||
def test__check_allocations_table_latin1(self, mock_reader):
|
||||
mock_engine = mock.Mock()
|
||||
mock_res = mock.Mock()
|
||||
mock_engine.url = '..mysql..'
|
||||
mock_engine.url = sa_url.make_url(
|
||||
'mysql+pymysql://ironic:pass@192.0.2.10/ironic')
|
||||
mock_res.all.return_value = (
|
||||
'... ENGINE=InnoDB DEFAULT CHARSET=latin1',
|
||||
)
|
||||
@ -86,7 +88,8 @@ class TestUpgradeChecks(db_base.DbTestCase):
|
||||
def test__check_allocations_table_myiasm(self, mock_reader):
|
||||
mock_engine = mock.Mock()
|
||||
mock_res = mock.Mock()
|
||||
mock_engine.url = '..mysql..'
|
||||
mock_engine.url = sa_url.make_url(
|
||||
'mysql+pymysql://ironic:pass@192.0.2.10/ironic')
|
||||
mock_res.all.return_value = (
|
||||
'... ENGINE=MyIASM DEFAULT CHARSET=utf8',
|
||||
)
|
||||
@ -114,7 +117,8 @@ class TestUpgradeChecks(db_base.DbTestCase):
|
||||
def test__check_allocations_table_myiasm_both(self, mock_reader):
|
||||
mock_engine = mock.Mock()
|
||||
mock_res = mock.Mock()
|
||||
mock_engine.url = '..mysql..'
|
||||
mock_engine.url = sa_url.make_url(
|
||||
'mysql+pymysql://ironic:pass@192.0.2.10/ironic')
|
||||
mock_res.all.return_value = (
|
||||
'... ENGINE=MyIASM DEFAULT CHARSET=latin1',
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user