From 4507378340125bab8acbbea68d037a240ae73825 Mon Sep 17 00:00:00 2001 From: Steve Smith Date: Tue, 13 Aug 2019 10:25:02 +1000 Subject: [PATCH] DCD-558: Add support for TCP and multicast clustering. --- config/confluence.cfg.xml.j2 | 13 ++++++++++--- tests/test_image.py | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 3 deletions(-) diff --git a/config/confluence.cfg.xml.j2 b/config/confluence.cfg.xml.j2 index 189fa1d..99fbaed 100644 --- a/config/confluence.cfg.xml.j2 +++ b/config/confluence.cfg.xml.j2 @@ -38,18 +38,25 @@ {% if atl_cluster_type is defined %} true - {{ atl_cluster_type }} + {{ atl_cluster_name }} {{ atl_product_home_shared }} - {{ atl_product_home_shared }} + {{ atl_cluster_type }} {% if atl_cluster_type == 'aws' %} {{ atl_hazelcast_network_aws_iam_role }} {{ atl_hazelcast_network_aws_iam_region }} {{ atl_hazelcast_network_aws_host_header }} {{ atl_hazelcast_network_aws_tag_key }} {{ atl_hazelcast_network_aws_tag_value }} - {{ atl_cluster_name }} {{ atl_cluster_ttl }} + + {% elif atl_cluster_type == 'tcp_ip' %} + {{ atl_cluster_peers }} + + {% elif atl_cluster_type == 'multicast' %} + {{ atl_cluster_address }} + {{ atl_cluster_ttl }} + {% endif %} {% endif %} diff --git a/tests/test_image.py b/tests/test_image.py index de4860c..d511f7e 100644 --- a/tests/test_image.py +++ b/tests/test_image.py @@ -267,3 +267,35 @@ def test_confluence_xml_cluster_aws(docker_cli, image): assert xml.xpath('//property[@name="confluence.cluster.aws.tag.value"]')[0].text == "atl_hazelcast_network_aws_tag_value" assert xml.xpath('//property[@name="confluence.cluster.name"]')[0].text == "atl_cluster_name" assert xml.xpath('//property[@name="confluence.cluster.ttl"]')[0].text == "atl_cluster_ttl" + +def test_confluence_xml_cluster_multicast(docker_cli, image): + environment = { + 'ATL_CLUSTER_TYPE': 'multicast', + 'ATL_CLUSTER_NAME': 'atl_cluster_name', + 'ATL_CLUSTER_TTL': 'atl_cluster_ttl', + 'ATL_CLUSTER_ADDRESS': '99.99.99.99' + } + container = run_image(docker_cli, image, environment=environment) + wait_for_file(container, "/var/atlassian/application-data/confluence/confluence.cfg.xml") + xml = etree.fromstring(container.file('/var/atlassian/application-data/confluence/confluence.cfg.xml').content) + + assert xml.xpath('//property[@name="confluence.cluster"]')[0].text == "true" + assert xml.xpath('//property[@name="confluence.cluster.join.type"]')[0].text == "multicast" + assert xml.xpath('//property[@name="confluence.cluster.name"]')[0].text == "atl_cluster_name" + assert xml.xpath('//property[@name="confluence.cluster.ttl"]')[0].text == "atl_cluster_ttl" + assert xml.xpath('//property[@name="confluence.cluster.address"]')[0].text == "99.99.99.99" + +def test_confluence_xml_cluster_tcp(docker_cli, image): + environment = { + 'ATL_CLUSTER_TYPE': 'tcp_ip', + 'ATL_CLUSTER_PEERS': '1.1.1.1,99.99.99.99', + 'ATL_CLUSTER_NAME': 'atl_cluster_name', + } + container = run_image(docker_cli, image, environment=environment) + wait_for_file(container, "/var/atlassian/application-data/confluence/confluence.cfg.xml") + xml = etree.fromstring(container.file('/var/atlassian/application-data/confluence/confluence.cfg.xml').content) + + assert xml.xpath('//property[@name="confluence.cluster"]')[0].text == "true" + assert xml.xpath('//property[@name="confluence.cluster.join.type"]')[0].text == "tcp_ip" + assert xml.xpath('//property[@name="confluence.cluster.name"]')[0].text == "atl_cluster_name" + assert xml.xpath('//property[@name="confluence.cluster.peers"]')[0].text == "1.1.1.1,99.99.99.99"