diff --git a/aodh/tests/functional/api/__init__.py b/aodh/tests/functional/api/__init__.py index c8fc8a37a..c9da6968f 100644 --- a/aodh/tests/functional/api/__init__.py +++ b/aodh/tests/functional/api/__init__.py @@ -43,7 +43,7 @@ class FunctionalTest(db_test_base.TestBase): self.CONF.set_override('policy_file', os.path.abspath('etc/aodh/policy.json'), - group='oslo_policy') + group='oslo_policy', enforce_type=True) self.app = self._make_app() def _make_app(self): diff --git a/aodh/tests/functional/api/v2/test_alarm_scenarios.py b/aodh/tests/functional/api/v2/test_alarm_scenarios.py index 6dedfab5a..a7fdb02a7 100644 --- a/aodh/tests/functional/api/v2/test_alarm_scenarios.py +++ b/aodh/tests/functional/api/v2/test_alarm_scenarios.py @@ -398,7 +398,8 @@ class TestAlarms(TestAlarmsBase): def test_get_alarm_forbiden(self): pf = os.path.abspath('aodh/tests/functional/api/v2/policy.json-test') - self.CONF.set_override('policy_file', pf, group='oslo_policy') + self.CONF.set_override('policy_file', pf, group='oslo_policy', + enforce_type=True) self.app = self._make_app() response = self.get_json('/alarms', diff --git a/aodh/tests/functional/db.py b/aodh/tests/functional/db.py index 9f6118d34..250ece91b 100644 --- a/aodh/tests/functional/db.py +++ b/aodh/tests/functional/db.py @@ -148,7 +148,8 @@ class TestBase(test_base.BaseTestCase): conf = service.prepare_service(argv=[], config_files=[]) self.CONF = self.useFixture(fixture_config.Config(conf)).conf - self.CONF.set_override('connection', db_url, group="database") + self.CONF.set_override('connection', db_url, group="database", + enforce_type=True) manager = self.DRIVER_MANAGERS.get(engine) if not manager: @@ -159,7 +160,7 @@ class TestBase(test_base.BaseTestCase): self.useFixture(self.db_manager) self.CONF.set_override('connection', self.db_manager.url, - group="database") + group="database", enforce_type=True) self.alarm_conn = storage.get_connection_from_config(self.CONF) self.alarm_conn.upgrade() diff --git a/aodh/tests/functional/gabbi/fixtures.py b/aodh/tests/functional/gabbi/fixtures.py index 73056a3f4..e85cf0f8d 100644 --- a/aodh/tests/functional/gabbi/fixtures.py +++ b/aodh/tests/functional/gabbi/fixtures.py @@ -70,12 +70,15 @@ class ConfigFixture(fixture.GabbiFixture): conf.set_override('policy_file', os.path.abspath( 'aodh/tests/open-policy.json'), - group='oslo_policy') + group='oslo_policy', + enforce_type=True) database_name = '%s-%s' % (db_url, str(uuid.uuid4())) - conf.set_override('connection', database_name, group='database') + conf.set_override('connection', database_name, group='database', + enforce_type=True) - conf.set_override('pecan_debug', True, group='api') + conf.set_override('pecan_debug', True, group='api', + enforce_type=True) def stop_fixture(self): """Reset the config and remove data.""" diff --git a/aodh/tests/functional/storage/test_get_connection.py b/aodh/tests/functional/storage/test_get_connection.py index 0bab3c565..12c31dd58 100644 --- a/aodh/tests/functional/storage/test_get_connection.py +++ b/aodh/tests/functional/storage/test_get_connection.py @@ -35,14 +35,15 @@ class EngineTest(base.BaseTestCase): def test_get_connection(self): self.CONF.set_override('connection', 'log://localhost', - group='database') + group='database', enforce_type=True) engine = storage.get_connection_from_config(self.CONF) self.assertIsInstance(engine, impl_log.Connection) def test_get_connection_no_such_engine(self): self.CONF.set_override('connection', 'no-such-engine://localhost', - group='database') - self.CONF.set_override('max_retries', 0, 'database') + group='database', enforce_type=True) + self.CONF.set_override('max_retries', 0, 'database', + enforce_type=True) try: storage.get_connection_from_config(self.CONF) except RuntimeError as err: @@ -69,9 +70,12 @@ class ConnectionRetryTest(base.BaseTestCase): raise ConnectionError log_init.side_effect = x - self.CONF.set_override("connection", "log://", "database") - self.CONF.set_override("retry_interval", 0.00001, "database") - self.CONF.set_override("max_retries", max_retries, "database") + self.CONF.set_override("connection", "log://", "database", + enforce_type=True) + self.CONF.set_override("retry_interval", 0.00001, "database", + enforce_type=True) + self.CONF.set_override("max_retries", max_retries, "database", + enforce_type=True) self.assertRaises(ConnectionError, storage.get_connection_from_config, self.CONF) @@ -85,6 +89,7 @@ class ConnectionConfigTest(base.BaseTestCase): self.CONF = self.useFixture(fixture_config.Config(conf)).conf def test_only_default_url(self): - self.CONF.set_override("connection", "log://", group="database") + self.CONF.set_override("connection", "log://", group="database", + enforce_type=True) conn = storage.get_connection_from_config(self.CONF) self.assertIsInstance(conn, impl_log.Connection) diff --git a/aodh/tests/functional/storage/test_impl_mongodb.py b/aodh/tests/functional/storage/test_impl_mongodb.py index 75f923c2e..a3386dfe8 100644 --- a/aodh/tests/functional/storage/test_impl_mongodb.py +++ b/aodh/tests/functional/storage/test_impl_mongodb.py @@ -51,11 +51,13 @@ class IndexTest(tests_db.TestBase): # create a fake index and check it is deleted coll = getattr(conn.db, coll_name) index_name = '%s_ttl' % coll_name - self.CONF.set_override(ttl_opt, -1, group='database') + self.CONF.set_override(ttl_opt, -1, group='database', + enforce_type=True) conn.upgrade() self.assertNotIn(index_name, coll.index_information()) - self.CONF.set_override(ttl_opt, 456789, group='database') + self.CONF.set_override(ttl_opt, 456789, group='database', + enforce_type=True) conn.upgrade() self.assertEqual(456789, coll.index_information() @@ -67,14 +69,16 @@ class IndexTest(tests_db.TestBase): def _test_ttl_index_present(self, conn, coll_name, ttl_opt): coll = getattr(conn.db, coll_name) - self.CONF.set_override(ttl_opt, 456789, group='database') + self.CONF.set_override(ttl_opt, 456789, group='database', + enforce_type=True) conn.upgrade() index_name = '%s_ttl' % coll_name self.assertEqual(456789, coll.index_information() [index_name]['expireAfterSeconds']) - self.CONF.set_override(ttl_opt, -1, group='database') + self.CONF.set_override(ttl_opt, -1, group='database', + enforce_type=True) conn.upgrade() self.assertNotIn(index_name, coll.index_information()) diff --git a/aodh/tests/unit/test_coordination.py b/aodh/tests/unit/test_coordination.py index f5ed39fc1..3b5d6e5cb 100644 --- a/aodh/tests/unit/test_coordination.py +++ b/aodh/tests/unit/test_coordination.py @@ -150,7 +150,7 @@ class TestPartitioning(base.BaseTestCase): coordinator_cls=None): coordinator_cls = coordinator_cls or MockToozCoordinator self.CONF.set_override('backend_url', 'xxx://yyy', - group='coordination') + group='coordination', enforce_type=True) with mock.patch('tooz.coordination.get_coordinator', lambda _, member_id: coordinator_cls(member_id, shared_storage)): diff --git a/aodh/tests/unit/test_evaluator.py b/aodh/tests/unit/test_evaluator.py index 36b6fc70f..24b47797b 100644 --- a/aodh/tests/unit/test_evaluator.py +++ b/aodh/tests/unit/test_evaluator.py @@ -57,7 +57,8 @@ class TestAlarmEvaluationService(tests_base.BaseTestCase): test_interval) self.CONF.set_override('heartbeat', coordination_heartbeat, - group='coordination') + group='coordination', + enforce_type=True) with mock.patch('aodh.storage.get_connection_from_config', return_value=self.storage_conn): p_coord_mock = self.svc.partition_coordinator diff --git a/tools/test_hbase_table_utils.py b/tools/test_hbase_table_utils.py index 60babb2d3..5e210c042 100644 --- a/tools/test_hbase_table_utils.py +++ b/tools/test_hbase_table_utils.py @@ -24,7 +24,8 @@ def main(argv): url = ("%s?table_prefix=%s" % (os.getenv("AODH_TEST_STORAGE_URL"), os.getenv("AODH_TEST_HBASE_TABLE_PREFIX", "test"))) - cfg.CONF.set_override("connection", url, group="database") + cfg.CONF.set_override("connection", url, group="database", + enforce_type=True) alarm_conn = storage.get_connection_from_config(cfg.CONF) for arg in argv: if arg == "--upgrade":