Merge ~chris.sanders/charm-rsyslog-forwarder-ha/+git/csanders:master into ~pguimaraes/charm-rsyslog-forwarder-ha/+git/rsyslog-forwarder-ha-charm:master

Proposed by Chris Sanders
Status: Merged
Approved by: Pedro Guimarães
Approved revision: a04af0f9b4fa53bcf2de6404c7ab7684783d755d
Merged at revision: a04af0f9b4fa53bcf2de6404c7ab7684783d755d
Proposed branch: ~chris.sanders/charm-rsyslog-forwarder-ha/+git/csanders:master
Merge into: ~pguimaraes/charm-rsyslog-forwarder-ha/+git/rsyslog-forwarder-ha-charm:master
Diff against target: 43 lines (+35/-0)
1 file modified
tests/unit/test_basic.py (+35/-0)
Reviewer Review Type Date Requested Status
Pedro Guimarães Approve
Review via email: mp+362705@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Pedro Guimarães (pguimaraes) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/tests/unit/test_basic.py b/tests/unit/test_basic.py
index 85991f8..bc61272 100644
--- a/tests/unit/test_basic.py
+++ b/tests/unit/test_basic.py
@@ -185,3 +185,38 @@ class HooksTestCase(unittest.TestCase):
185 fanout.assert_called_once()185 fanout.assert_called_once()
186186
187 self.service_restart.assert_called_once_with("rsyslog")187 self.service_restart.assert_called_once_with("rsyslog")
188
189 @mock.patch("hooks.hooks.update_failover_replication")
190 @mock.patch("hooks.hooks.update_fanout_replication")
191 def test_update_replication_bad_charm_config(self, fanout, failover):
192 """check if update_replication works with fanout replication mode"""
193
194 class DummyServer(object):
195 @classmethod
196 def all(self, *args, **kwargs):
197 return [{}, {}]
198
199 self.session.query.return_value = DummyServer()
200 self.config_get.return_value = 'wrong format'
201
202 hooks.update_replication()
203 args, kwargs = self.juju_log.call_args
204 assert "found: wrong format" in args[0]
205
206 @mock.patch("hooks.hooks.Server")
207 @mock.patch("hooks.hooks.update_failover_replication")
208 @mock.patch("hooks.hooks.update_fanout_replication")
209 def test_update_replication_good_charm_config(self, fanout, failover, Server):
210 """check if update_replication works with fanout replication mode"""
211
212 class DummyServer(object):
213 @classmethod
214 def all(self, *args, **kwargs):
215 return [{}, {}]
216
217 self.session.query.return_value = DummyServer()
218 self.config_get.return_value = \
219 'hostname1=host_ip1,hostname2=host_ip2,hostname3=host_ip3'
220
221 hooks.update_replication()
222 assert Server.called

Subscribers

People subscribed via source and target branches