From 81d106e36bdb33480b186dad65db4fdab74e3e85 Mon Sep 17 00:00:00 2001 From: Jun jeong Date: Tue, 27 Aug 2024 14:51:19 +1000 Subject: [PATCH] DCCLIP-1068: option to override ATL_SECURE_PROPERTIES --- config/confluence.cfg.xml.j2 | 3 ++- tests/test_image.py | 17 +++++++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/config/confluence.cfg.xml.j2 b/config/confluence.cfg.xml.j2 index bbca7bb..cf9a9b1 100644 --- a/config/confluence.cfg.xml.j2 +++ b/config/confluence.cfg.xml.j2 @@ -98,7 +98,8 @@ {# Confluence versions 9.1 and newer #} {% if (confluence_version.split(".")[0] | int() == 9 and confluence_version.split(".")[1] | int() >= 1) or confluence_version.split(".")[0] | int() > 9 %} - true + {% set secure_properties = atl_secure_properties if atl_secure_properties is defined else 'true' %} + {{ secure_properties }} {% endif %} diff --git a/tests/test_image.py b/tests/test_image.py index 80393ab..cbe526e 100644 --- a/tests/test_image.py +++ b/tests/test_image.py @@ -719,7 +719,7 @@ def test_skip_custom_allowlist_secure_vars(docker_cli, image, run_user): raise EOFError(f"Found unexpected log line") @pytest.mark.parametrize("version,secure_properties_flag_expected", [('6.9.0', 'false'), ('9.0.1', 'false'), ('9.1.0', 'true'), ('9.2.0', 'true')]) -def test_confluence_xml_secure_properties(docker_cli, image, version, secure_properties_flag_expected): +def test_confluence_xml_secure_properties_default(docker_cli, image, version, secure_properties_flag_expected): environment = { 'CONFLUENCE_VERSION': version, } @@ -731,4 +731,17 @@ def test_confluence_xml_secure_properties(docker_cli, image, version, secure_pro if secure_properties_flag_expected.lower() == 'true': assert secure_properties_elements[0].text == "true" else: - assert len(secure_properties_elements) == 0 \ No newline at end of file + assert len(secure_properties_elements) == 0 + +@pytest.mark.parametrize("version,overrideVar", [('9.1.0', 'false'), ('9.2.0', 'true')]) +def test_confluence_xml_secure_properties_override(docker_cli, image, version, overrideVar): + environment = { + 'CONFLUENCE_VERSION': version, + 'ATL_SECURE_PROPERTIES' overrideVar, + } + container = run_image(docker_cli, image, environment=environment) + + xml = parse_xml(container, f'{get_app_home(container)}/confluence.cfg.xml') + secure_properties_elements = xml.findall('.//property[@name="secure.properties"]') + + assert secure_properties_elements[0].text == overrideVar \ No newline at end of file