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
1diff --git a/tests/unit/test_basic.py b/tests/unit/test_basic.py
2index 85991f8..bc61272 100644
3--- a/tests/unit/test_basic.py
4+++ b/tests/unit/test_basic.py
5@@ -185,3 +185,38 @@ class HooksTestCase(unittest.TestCase):
6 fanout.assert_called_once()
7
8 self.service_restart.assert_called_once_with("rsyslog")
9+
10+ @mock.patch("hooks.hooks.update_failover_replication")
11+ @mock.patch("hooks.hooks.update_fanout_replication")
12+ def test_update_replication_bad_charm_config(self, fanout, failover):
13+ """check if update_replication works with fanout replication mode"""
14+
15+ class DummyServer(object):
16+ @classmethod
17+ def all(self, *args, **kwargs):
18+ return [{}, {}]
19+
20+ self.session.query.return_value = DummyServer()
21+ self.config_get.return_value = 'wrong format'
22+
23+ hooks.update_replication()
24+ args, kwargs = self.juju_log.call_args
25+ assert "found: wrong format" in args[0]
26+
27+ @mock.patch("hooks.hooks.Server")
28+ @mock.patch("hooks.hooks.update_failover_replication")
29+ @mock.patch("hooks.hooks.update_fanout_replication")
30+ def test_update_replication_good_charm_config(self, fanout, failover, Server):
31+ """check if update_replication works with fanout replication mode"""
32+
33+ class DummyServer(object):
34+ @classmethod
35+ def all(self, *args, **kwargs):
36+ return [{}, {}]
37+
38+ self.session.query.return_value = DummyServer()
39+ self.config_get.return_value = \
40+ 'hostname1=host_ip1,hostname2=host_ip2,hostname3=host_ip3'
41+
42+ hooks.update_replication()
43+ assert Server.called

Subscribers

People subscribed via source and target branches