From ab8208d13f70f7c9df609146c5789eeab88b30ff Mon Sep 17 00:00:00 2001 From: "sonu.kumar" Date: Mon, 15 Feb 2016 16:41:37 +0530 Subject: [PATCH] Adding v2 namespaced event to zone manager Change-Id: Ic5cedb3bd72b95a14665d1a0d14b9b902b92fa61 Closes-bug: #1544911 --- .../tests/unit/test_zone_manager/test_tasks.py | 15 +++++++++++++-- designate/zone_manager/tasks.py | 1 + 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/designate/tests/unit/test_zone_manager/test_tasks.py b/designate/tests/unit/test_zone_manager/test_tasks.py index 7fef90bee..f4694692c 100644 --- a/designate/tests/unit/test_zone_manager/test_tasks.py +++ b/designate/tests/unit/test_zone_manager/test_tasks.py @@ -165,9 +165,14 @@ class PeriodicExistsTest(TaskTest): data = dict(zone) data.update(self.period_data) - self.mock_notifier.info.assert_called_with( + # Ensure both the old (domain) and new (zone) events are fired + # until the old is fully deprecated. + self.mock_notifier.info.assert_any_call( self.ctxt, "dns.domain.exists", data) + self.mock_notifier.info.assert_any_call( + self.ctxt, "dns.zone.exists", data) + def test_emit_exists_no_zones(self): with mock.patch.object(self.task, '_iter_zones') as iter_: iter_.return_value = [] @@ -184,9 +189,15 @@ class PeriodicExistsTest(TaskTest): for z in zones: data = dict(z) data.update(self.period_data) - self.mock_notifier.info.assert_called_with( + + # Ensure both the old (domain) and new (zone) events are fired + # until the old is fully deprecated. + self.mock_notifier.info.assert_any_call( self.ctxt, "dns.domain.exists", data) + self.mock_notifier.info.assert_any_call( + self.ctxt, "dns.zone.exists", data) + class PeriodicSecondaryRefreshTest(TaskTest): def setUp(self): diff --git a/designate/zone_manager/tasks.py b/designate/zone_manager/tasks.py index d808c5968..0e4040ecb 100644 --- a/designate/zone_manager/tasks.py +++ b/designate/zone_manager/tasks.py @@ -192,6 +192,7 @@ class PeriodicExistsTask(PeriodicTask): zone_data.update(extra_data) self.notifier.info(ctxt, 'dns.domain.exists', zone_data) + self.notifier.info(ctxt, 'dns.zone.exists', zone_data) LOG.info(_LI("Finished emitting %(counter)d events for shards " "%(start)s to %(end)s"),