From f6ae0ecf81903e5c0d889cfe5ae12ef0a25d321a Mon Sep 17 00:00:00 2001 From: nghazalibeiklar Date: Mon, 17 Jan 2022 12:46:01 +1100 Subject: [PATCH] Fixed unit tests --- tests/test_image.py | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/tests/test_image.py b/tests/test_image.py index 163f1d5..3786721 100644 --- a/tests/test_image.py +++ b/tests/test_image.py @@ -175,7 +175,7 @@ def test_server_xml_access_log(docker_cli, image): value = xml.find('.//Context/Valve[@className="org.apache.catalina.valves.RemoteIpValve"]') assert value.get('internalProxies') == environment.get('ATL_TOMCAT_PROXY_INTERNAL_IPS') -def test_server_xml_access_log_default_4_confluence_before_7_11(docker_cli, image): +def test_server_xml_access_log_default_ver_lt_7_11(docker_cli, image): environment = { #'ATL_TOMCAT_ACCESS_LOG': Not defined, 'ATL_TOMCAT_PROXY_INTERNAL_IPS': '192.168.1.1', @@ -189,21 +189,6 @@ def test_server_xml_access_log_default_4_confluence_before_7_11(docker_cli, imag value = xml.find('.//Context/Valve[@className="org.apache.catalina.valves.RemoteIpValve"]') assert value is None -def test_server_xml_access_log_default_4_confluence_after_7_11(docker_cli, image): - environment = { - #'ATL_TOMCAT_ACCESS_LOG': Not defined, - 'ATL_TOMCAT_PROXY_INTERNAL_IPS': '192.168.1.1', - 'CONFLUENCE_VERSION': '7.12.0', - } - - container = run_image(docker_cli, image, environment=environment) - _jvm = wait_for_proc(container, get_bootstrap_proc(container)) - - xml = parse_xml(container, f'{get_app_install_dir(container)}/conf/server.xml') - value = xml.find('.//Context/Valve[@className="org.apache.catalina.valves.RemoteIpValve"]') - assert '7.12.0' == environment.get('ATL_TOMCAT_PROXY_INTERNAL_IPS') - assert value.get('internalProxies') == environment.get('ATL_TOMCAT_PROXY_INTERNAL_IPS') - def test_server_xml_access_log_disabled(docker_cli, image): environment = { 'ATL_TOMCAT_ACCESS_LOG': 'false', @@ -217,6 +202,20 @@ def test_server_xml_access_log_disabled(docker_cli, image): value = xml.find('.//Context/Valve[@className="org.apache.catalina.valves.RemoteIpValve"]') assert value is None +def test_server_xml_access_log_default_ver_gt_7_11(docker_cli, image): + environment = { + #'ATL_TOMCAT_ACCESS_LOG': Not defined, + 'ATL_TOMCAT_PROXY_INTERNAL_IPS': '192.168.1.1', + 'CONFLUENCE_VERSION': '7.12.0', + } + + container = run_image(docker_cli, image, environment=environment) + _jvm = wait_for_proc(container, get_bootstrap_proc(container)) + + xml = parse_xml(container, f'{get_app_install_dir(container)}/conf/server.xml') + value = xml.find('.//Context/Valve[@className="org.apache.catalina.valves.RemoteIpValve"]') + assert value.get('internalProxies') == environment.get('ATL_TOMCAT_PROXY_INTERNAL_IPS') + def test_seraph_defaults(docker_cli, image): container = run_image(docker_cli, image) _jvm = wait_for_proc(container, get_bootstrap_proc(container))