From 0382f7db00ddb614a9288a39ef487ffc28013876 Mon Sep 17 00:00:00 2001 From: Tin Lam Date: Mon, 15 May 2017 14:22:04 -0500 Subject: [PATCH] Update driver config parameter from string to list This patch set fixes a gating issue where the parameter passes into [oslo_messaging_notifications] driver is a string rather than a list. This causes the code to enumerate over the string when [audit_middleware_notifications] driver is set to None. Per [0], that parameter should be a list instead of a string. [0] https://github.com/openstack/oslo.messaging/blob/master/oslo_messaging/notify/notifier.py#L35 Change-Id: Iab92629b19f46aa3bff96aa6a22b5a609a4ff76e --- .../tests/unit/audit/test_audit_oslo_messaging.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/keystonemiddleware/tests/unit/audit/test_audit_oslo_messaging.py b/keystonemiddleware/tests/unit/audit/test_audit_oslo_messaging.py index a745e2fb..96127890 100644 --- a/keystonemiddleware/tests/unit/audit/test_audit_oslo_messaging.py +++ b/keystonemiddleware/tests/unit/audit/test_audit_oslo_messaging.py @@ -18,7 +18,8 @@ from keystonemiddleware.tests.unit.audit import base class AuditNotifierConfigTest(base.BaseAuditMiddlewareTest): def test_conf_middleware_log_and_default_as_messaging(self): - self.cfg.config(driver='log', group='audit_middleware_notifications') + self.cfg.config(driver='log', + group='audit_middleware_notifications') app = self.create_simple_app() with mock.patch('oslo_messaging.notify._impl_log.LogDriver.notify', side_effect=Exception('error')) as driver: @@ -28,7 +29,7 @@ class AuditNotifierConfigTest(base.BaseAuditMiddlewareTest): self.assertTrue(driver.called) def test_conf_middleware_log_and_oslo_msg_as_messaging(self): - self.cfg.config(driver='messaging', + self.cfg.config(driver=['messaging'], group='oslo_messaging_notifications') self.cfg.config(driver='log', group='audit_middleware_notifications') @@ -42,7 +43,7 @@ class AuditNotifierConfigTest(base.BaseAuditMiddlewareTest): self.assertTrue(driver.called) def test_conf_middleware_messaging_and_oslo_msg_as_log(self): - self.cfg.config(driver='log', group='oslo_messaging_notifications') + self.cfg.config(driver=['log'], group='oslo_messaging_notifications') self.cfg.config(driver='messaging', group='audit_middleware_notifications') app = self.create_simple_app() @@ -55,7 +56,7 @@ class AuditNotifierConfigTest(base.BaseAuditMiddlewareTest): self.assertTrue(driver.called) def test_with_no_middleware_notification_conf(self): - self.cfg.config(driver='messaging', + self.cfg.config(driver=['messaging'], group='oslo_messaging_notifications') self.cfg.config(driver=None, group='audit_middleware_notifications')