Merge lp:~simpoir/landscape-charm/1501803_ha_amqp into lp:landscape-charm

Proposed by Simon Poirier
Status: Merged
Approved by: Simon Poirier
Approved revision: 404
Merged at revision: 404
Proposed branch: lp:~simpoir/landscape-charm/1501803_ha_amqp
Merge into: lp:landscape-charm
Diff against target: 52 lines (+28/-2)
2 files modified
lib/tests/test_templates.py (+26/-0)
templates/service.conf (+2/-2)
To merge this branch: bzr merge lp:~simpoir/landscape-charm/1501803_ha_amqp
Reviewer Review Type Date Requested Status
Maximiliano Bertacchini Approve
Review via email: mp+406052@code.launchpad.net

Commit message

Add all units to broker section with HA rabbitmq.

Description of the change

Add all units to broker section with HA rabbitmq.

Testing instructions:

juju bootstrap localhost
make bundles-local-charm
juju deploy ./bundles/build/landscape-scalable/bundle.yaml
juju add-unit rabbitmq-server
# wait for units to settle
juju run --unit landscape-server/0 -- cat /etc/landscape/service.conf|grep -n3 broker

To post a comment you must log in.
Revision history for this message
Maximiliano Bertacchini (maxiberta) wrote :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/tests/test_templates.py'
2--- lib/tests/test_templates.py 2021-04-13 19:03:22 +0000
3+++ lib/tests/test_templates.py 2021-07-21 22:39:31 +0000
4@@ -240,6 +240,32 @@
5 "/etc/landscape/gpg-passphrase.txt",
6 config.get("api", "gpg-passphrase-path"))
7
8+ def test_broker_ha(self):
9+ """
10+ Verify that broker gets a list of multiple rabbit servers if
11+ multiple such units exist.
12+ """
13+ self.context["amqp"] = [
14+ {
15+ "hostname": "roger",
16+ "password": "secret",
17+ },
18+ {
19+ "hostname": "bugs",
20+ "password": "secret",
21+ },
22+ {
23+ "hostname": "lola",
24+ "password": "secret",
25+ },
26+ ]
27+
28+ buffer = StringIO(self.template.render(self.context))
29+ config = ConfigParser()
30+ config.readfp(buffer)
31+ self.assertEqual("roger,bugs,lola", config.get("broker", "host"))
32+ self.assertEqual("secret", config.get("broker", "password"))
33+
34
35 class LandscapeDefaultsTest(TemplateTest):
36
37
38=== modified file 'templates/service.conf'
39--- templates/service.conf 2021-04-16 19:21:23 +0000
40+++ templates/service.conf 2021-07-21 22:39:31 +0000
41@@ -24,9 +24,9 @@
42
43 [broker]
44 port = 5672
45-host = {{ rabbitmq["hostname"] }}
46+host = {{ amqp|join(",", attribute="hostname") }}
47 user = landscape
48-password = {{ rabbitmq["password"] }}
49+password = {{ amqp[0]["password"] }}
50 vhost = landscape
51
52 [schema]

Subscribers

People subscribed via source and target branches