diff --git a/tests/_sql_livetest.py b/tests/_sql_livetest.py new file mode 100644 index 0000000000..d989097916 --- /dev/null +++ b/tests/_sql_livetest.py @@ -0,0 +1,37 @@ +# vim: tabstop=4 shiftwidth=4 softtabstop=4 + +# Copyright 2013 Red Hat, Inc +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +import test_sql_upgrade + +from keystone import config + +CONF = config.CONF + + +class PostgresqlMigrateTests(test_sql_upgrade.SqlUpgradeTests): + def config_files(self): + files = (test_sql_upgrade.SqlUpgradeTests. + _config_file_list[:]) + files.append("backend_postgresql.conf") + return files + + +class MysqlMigrateTests(test_sql_upgrade.SqlUpgradeTests): + def config_files(self): + files = (test_sql_upgrade.SqlUpgradeTests. + _config_file_list[:]) + files.append("backend_mysql.conf") + return files diff --git a/tests/backend_mysql.conf b/tests/backend_mysql.conf new file mode 100644 index 0000000000..ee3b276ebe --- /dev/null +++ b/tests/backend_mysql.conf @@ -0,0 +1,4 @@ +#Used for running the Migrate tests against a live Mysql Server +#See _sql_livetest.py +[sql] +connection = mysql://keystone:keystone@localhost/keystone_test?charset=utf8 diff --git a/tests/backend_postgresql.conf b/tests/backend_postgresql.conf new file mode 100644 index 0000000000..8468ad33fd --- /dev/null +++ b/tests/backend_postgresql.conf @@ -0,0 +1,4 @@ +#Used for running the Migrate tests against a live Postgresql Server +#See _sql_livetest.py +[sql] +connection = postgresql://keystone:keystone@localhost/keystone_test?client_encoding=utf8 diff --git a/tests/test_sql_upgrade.py b/tests/test_sql_upgrade.py index 51ac2b7d4b..59a8800cb2 100644 --- a/tests/test_sql_upgrade.py +++ b/tests/test_sql_upgrade.py @@ -50,11 +50,18 @@ class SqlUpgradeTests(test.TestCase): self.metadata = sqlalchemy.MetaData() self.metadata.bind = self.engine + _config_file_list = [test.etcdir('keystone.conf.sample'), + test.testsdir('test_overrides.conf'), + test.testsdir('backend_sql.conf')] + + #override this to sepcify the complete list of configuration files + def config_files(self): + return self._config_file_list + def setUp(self): super(SqlUpgradeTests, self).setUp() - self.config([test.etcdir('keystone.conf.sample'), - test.testsdir('test_overrides.conf'), - test.testsdir('backend_sql.conf')]) + + self.config(self.config_files()) self.base = sql.Base() # create and share a single sqlalchemy engine for testing