Keystone has the testcase that need run against real live DB such as MysqL or Postgresql other than sqlITE.@H_502_1@
@H_502_1@
But it just skipped when you try to run the testcase in the usual way like this.@H_502_1@
@H_502_1@
$ python -m unittest keystone.tests.unit.test_sql_upgrade.MysqLOpportunisticFullMigration.test_trust_fk_on_delete_cascade_enforced
s
----------------------------------------------------------------------
Ran 1 test in 0.053s
OK (skipped=1)
@H_502_1@
@H_502_1@
@H_502_1@
Before Keystone Newtone release,we have the configure file that support to configure the connection string and let the testcase run with that connections.@H_502_1@
@H_502_1@
Example in the Mitaka:@H_502_1@
diff --git a/keystone/tests/unit/config_files/backend_MysqL.conf b/keystone/tests/unit/config_files/backend_MysqL.conf@H_502_1@
index2495f03..65b22d3 100644@H_502_1@
---a/keystone/tests/unit/config_files/backend_MysqL.conf@H_502_1@
+++b/keystone/tests/unit/config_files/backend_MysqL.conf@H_502_1@
@@-1,4 +1,5 @@@H_502_1@
#Used for running the Migrate tests against alive MysqL Server@H_502_1@
#See _sql_livetest.py@H_502_1@
[database]@H_502_1@
-connection= MysqL+pyMysqL://keystone:keystone@localhost/keystone_test?charset=utf8@H_502_1@
+#connection= MysqL+pyMysqL://keystone:keystone@localhost/keystone_test?charset=utf8@H_502_1@
+connection= MysqL+pyMysqL://root:zaq12wsx@127.0.0.1/abc?charset=utf8@H_502_1@
@H_502_1@
But we have have dropped all these support in Newton,so how to do with it if there is a need to run these live testcases?
@H_502_1@
@H_502_1@
Based on the manual from oslo.db,we can get some clue on that. It says we should set the DB connection string to make it use the real live DB.@H_502_1@
Quote:@H_502_1@
#oslo.db\oslo_db\sqlalchemy\test_base.py@H_502_1@
1 class DbFixture(fixtures.Fixture):@H_502_1@
2 """Basic database fixture.@H_502_1@
3 @H_502_1@
4 Allows to run testson varIoUs db backends,such as sqlite,MysqL and@H_502_1@
5 Postgresql. Bydefault use sqlite backend. To override default backend@H_502_1@
6 uri set env variableOS_TEST_DBAPI_ADMIN_CONNECTION with database admin@H_502_1@
7 credentials forspecific backend.@H_502_1@
8 """@H_502_1@
9 @H_502_1@
@H_502_1@
@H_502_1@
So,before you run the live test,you should set the connection string by set the ENV as this:@H_502_1@
exportOS_TEST_DBAPI_ADMIN_CONNECTION=MysqL+pyMysqL://root:zaq12wsx@127.0.0.1/abc?charset=utf8@H_502_1@
@H_502_1@
@H_502_1@
Then runthe testcase in your usual way@H_502_1@
testr runkeystone.tests.unit.test_sql_upgrade.MysqLOpportunisticFullMigration.test_trust_fk_on_delete_cascade_enforced@H_502_1@
@H_502_1@
Or for the dubug mode:@H_502_1@
@H_502_1@
python -m unittestkeystone.tests.unit.test_sql_upgrade.MysqLOpportunisticFullMigration.test_trust_fk_on_delete_cascade_enforced@H_502_1@
@H_502_1@
Then it will use the live DB for test.@H_502_1@