Exemple #1
0
def test_first_run_state(docker_cli, image, run_user):
    PORT = 8080
    URL = f'http://localhost:{PORT}/status'
    
    container = run_image(docker_cli, image, user=run_user, ports={PORT: PORT})
    
    wait_for_http_response(URL, expected_status=200, expected_state=('STARTING', 'FIRST_RUN'))
def test_cluster_properties_defaults(docker_cli, image, run_user):
    environment = {
        'CLUSTERED': 'true',
    }
    container = run_image(docker_cli, image, environment=environment)
    _jvm = wait_for_proc(container, get_bootstrap_proc(container))

    properties = parse_properties(
        container, f'{get_app_home(container)}/cluster.properties')
    container_id = container.file('/etc/container_id').content.decode().strip()

    assert len(container_id) > 0

    assert properties.get('jira.node.id') == container_id
    assert properties.get(
        'jira.shared.home') == '/var/atlassian/application-data/jira/shared'
    assert properties.get('ehcache.peer.discovery') is None
    assert properties.get('ehcache.listener.hostName') is None
    assert properties.get('ehcache.listener.port') is None
    assert properties.get('ehcache.object.port') is None
    assert properties.get('ehcache.listener.socketTimeoutMillis') is None
    assert properties.get('ehcache.multicast.address') is None
    assert properties.get('ehcache.multicast.port') is None
    assert properties.get('ehcache.multicast.timeToLive') is None
    assert properties.get('ehcache.multicast.hostName') is None
def test_confluence_xml_cluster_multicast(docker_cli, image, run_user):
    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,
                          user=run_user,
                          environment=environment)
    _jvm = wait_for_proc(container, get_bootstrap_proc(container))

    xml = parse_xml(container, f'{get_app_home(container)}/confluence.cfg.xml')

    assert xml.findall(
        './/property[@name="confluence.cluster"]')[0].text == "true"
    assert xml.findall('.//property[@name="confluence.cluster.join.type"]'
                       )[0].text == "multicast"
    assert xml.findall('.//property[@name="confluence.cluster.name"]'
                       )[0].text == "atl_cluster_name"
    assert xml.findall('.//property[@name="confluence.cluster.ttl"]'
                       )[0].text == "atl_cluster_ttl"
    assert xml.findall('.//property[@name="confluence.cluster.address"]'
                       )[0].text == "99.99.99.99"
Exemple #4
0
def test_cluster_properties_params(docker_cli, image, run_user):
    environment = {
        'CLUSTERED': 'true',
        'JIRA_NODE_ID': 'jiradc1',
        'JIRA_SHARED_HOME': '/data/shared',
        'EHCACHE_PEER_DISCOVERY': 'default',
        'EHCACHE_LISTENER_HOSTNAME': 'jiradc1.local',
        'EHCACHE_LISTENER_PORT': '40002',
        'EHCACHE_OBJECT_PORT': '40003',
        'EHCACHE_LISTENER_SOCKETTIMEOUTMILLIS': '2001',
        'EHCACHE_MULTICAST_ADDRESS': '1.2.3.4',
        'EHCACHE_MULTICAST_PORT': '40004',
        'EHCACHE_MULTICAST_TIMETOLIVE': '1000',
        'EHCACHE_MULTICAST_HOSTNAME': 'jiradc1.local',
    }
    container = run_image(docker_cli, image, user=run_user, environment=environment)
    _jvm = wait_for_proc(container, get_bootstrap_proc(container))
    
    properties = parse_properties(container, f'{get_app_home(container)}/cluster.properties')

    assert properties.get('jira.node.id') == environment.get('JIRA_NODE_ID')
    assert properties.get('jira.shared.home') == environment.get('JIRA_SHARED_HOME')
    assert properties.get('ehcache.peer.discovery') == environment.get('EHCACHE_PEER_DISCOVERY')
    assert properties.get('ehcache.listener.hostName') == environment.get('EHCACHE_LISTENER_HOSTNAME')
    assert properties.get('ehcache.listener.port') == environment.get('EHCACHE_LISTENER_PORT')
    assert properties.get('ehcache.object.port') == environment.get('EHCACHE_OBJECT_PORT')
    assert properties.get('ehcache.listener.socketTimeoutMillis') == environment.get('EHCACHE_LISTENER_SOCKETTIMEOUTMILLIS')
    assert properties.get('ehcache.multicast.address') == environment.get('EHCACHE_MULTICAST_ADDRESS')
    assert properties.get('ehcache.multicast.port') == environment.get('EHCACHE_MULTICAST_PORT')
    assert properties.get('ehcache.multicast.timeToLive') == environment.get('EHCACHE_MULTICAST_TIMETOLIVE')
    assert properties.get('ehcache.multicast.hostName') == environment.get('EHCACHE_MULTICAST_HOSTNAME')
def test_dbconfig_xml_defaults(docker_cli, image):
    environment = {
        'ATL_DB_TYPE': 'postgres72',
        'ATL_DB_DRIVER': 'org.postgresql.Driver',
        'ATL_JDBC_URL':
        'jdbc:postgresql://mypostgres.mycompany.org:5432/jiradb',
        'ATL_JDBC_USER': '******',
        'ATL_JDBC_PASSWORD': '******',
    }
    container = run_image(docker_cli, image, environment=environment)
    _jvm = wait_for_proc(container, get_bootstrap_proc(container))

    xml = parse_xml(container, f'{get_app_home(container)}/dbconfig.xml')

    assert xml.findtext('.//pool-min-size') == '20'
    assert xml.findtext('.//pool-max-size') == '100'
    assert xml.findtext('.//pool-min-idle') == '10'
    assert xml.findtext('.//pool-max-idle') == '20'

    assert xml.findtext('.//pool-max-wait') == '30000'
    assert xml.findtext('.//validation-query') == 'select 1'
    assert xml.findtext('.//time-between-eviction-runs-millis') == '30000'
    assert xml.findtext('.//min-evictable-idle-time-millis') == '5000'

    assert xml.findtext('.//pool-remove-abandoned') == 'true'
    assert xml.findtext('.//pool-remove-abandoned-timeout') == '300'
    assert xml.findtext('.//pool-test-while-idle') == 'true'
    assert xml.findtext('.//pool-test-on-borrow') == 'false'
Exemple #6
0
def test_server_xml_catalina_fallback(docker_cli, image):
    environment = {
        'CATALINA_CONNECTOR_PROXYNAME': 'crowd.atlassian.com',
        'CATALINA_CONNECTOR_PROXYPORT': '443',
        'CATALINA_CONNECTOR_SECURE': 'true',
        'CATALINA_CONNECTOR_SCHEME': 'https',
        'CATALINA_CONTEXT_PATH': '/mycrowd',
    }
    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)}/apache-tomcat/conf/server.xml')
    connector = xml.find('.//Connector')
    context = xml.find('.//Context')

    assert connector.get('proxyName') == environment.get(
        'CATALINA_CONNECTOR_PROXYNAME')
    assert connector.get('proxyPort') == environment.get(
        'CATALINA_CONNECTOR_PROXYPORT')
    assert connector.get('secure') == environment.get(
        'CATALINA_CONNECTOR_SECURE')
    assert connector.get('scheme') == environment.get(
        'CATALINA_CONNECTOR_SCHEME')
Exemple #7
0
def test_jvm_fallback_fonts(docker_cli, image):
    container = run_image(docker_cli, image)
    _jvm = wait_for_proc(container, get_bootstrap_proc(container))

    font = container.file(
        "/opt/java/openjdk/lib/fonts/fallback/NotoSansGujarati-Regular.ttf")
    assert font.exists
    assert font.is_symlink
def test_confluence_xml_default(docker_cli, image):
    container = run_image(docker_cli, image)
    _jvm = wait_for_proc(container, get_bootstrap_proc(container))

    xml = parse_xml(container, f'{get_app_home(container)}/confluence.cfg.xml')
    assert xml.findall('.//buildNumber')[0].text == "0"
    assert xml.findall('.//property[@name="hibernate.connection.url"]') == []
    assert xml.findall('.//property[@name="confluence.cluster.home"]') == []
def test_install_permissions(docker_cli, image):
    container = run_image(docker_cli, image)

    assert container.file(f'{get_app_install_dir(container)}').user == 'root'

    for d in ['logs', 'work', 'temp']:
        path = f'{get_app_install_dir(container)}/{d}'
        assert container.file(path).user == 'confluence'
def test_seraph_defaults(docker_cli, image):
    container = run_image(docker_cli, image)
    _jvm = wait_for_proc(container, get_bootstrap_proc(container))

    xml = parse_xml(
        container,
        f'{get_app_install_dir(container)}/confluence/WEB-INF/classes/seraph-config.xml'
    )
    param = xml.findall('.//param-name[.="autologin.cookie.age"]') == []
Exemple #11
0
def test_heap_dump(docker_cli, image, run_user):
    container = run_image(docker_cli, image, user=run_user)
    wait_for_proc(container, get_bootstrap_proc(container))
    
    heap_cmd = f'/opt/atlassian/support/heap-dump.sh'
    container.run(heap_cmd)
    
    ls_cmd = f'ls -la {get_app_home(container)}/heap.bin'
    heap_dump = container.run(ls_cmd).stdout.splitlines()
    assert len(heap_dump) == 1
Exemple #12
0
def test_confluence_lucene_index(docker_cli, image):
    container = run_image(
        docker_cli,
        image,
        environment={'ATL_LUCENE_INDEX_DIR': '/some/other/dir'})
    _jvm = wait_for_proc(container, get_bootstrap_proc(container))

    xml = parse_xml(container, f'{get_app_home(container)}/confluence.cfg.xml')
    assert xml.findall(
        './/property[@name="lucene.index.dir"]')[0].text == '/some/other/dir'
def test_conf_init_set(docker_cli, image):
    container = run_image(docker_cli,
                          image,
                          environment={"CONFLUENCE_HOME": "/tmp/"})
    _jvm = wait_for_proc(container, get_bootstrap_proc(container))

    init = container.file(
        f'{get_app_install_dir(container)}/confluence/WEB-INF/classes/confluence-init.properties'
    )
    assert init.contains("confluence.home = /tmp/")
Exemple #14
0
def test_install_permissions(docker_cli, image):
    container = run_image(docker_cli, image)

    assert container.file(f'{get_app_install_dir(container)}').user == 'root'
    assert container.file(
        f'{get_app_install_dir(container)}/app/META-INF/MANIFEST.MF'
    ).user == 'root'
    assert container.file(
        f'{get_app_install_dir(container)}/bin/start-bitbucket.sh'
    ).user == 'root'
def test_seraph_login_set(docker_cli, image):
    container = run_image(docker_cli,
                          image,
                          environment={"ATL_AUTOLOGIN_COOKIE_AGE": "TEST_VAL"})
    _jvm = wait_for_proc(container, get_bootstrap_proc(container))

    xml = parse_xml(
        container,
        f'{get_app_install_dir(container)}/confluence/WEB-INF/classes/seraph-config.xml'
    )
    assert xml.findall('.//param-value[.="TEST_VAL"]')[0].text == "TEST_VAL"
Exemple #16
0
def test_heap_dump_overwrite_true(docker_cli, image, run_user):
    container = run_image(docker_cli, image, user=run_user)
    wait_for_proc(container, get_bootstrap_proc(container))
    
    heap_cmd = f'/opt/atlassian/support/heap-dump.sh --force'
    ls_cmd = f'ls -la {get_app_home(container)}/heap.bin'
    
    container.run(heap_cmd)
    heap_dump_1 = container.run(ls_cmd).stdout.splitlines()
    container.run(heap_cmd)
    heap_dump_2 = container.run(ls_cmd).stdout.splitlines()
    assert heap_dump_1 != heap_dump_2
def test_seraph_xml_defaults(docker_cli, image):
    container = run_image(docker_cli, image)
    _jvm = wait_for_proc(container, get_bootstrap_proc(container))

    xml = parse_xml(
        container,
        f'{get_app_install_dir(container)}/atlassian-jira/WEB-INF/classes/seraph-config.xml'
    )
    assert [
        el.findtext('.//param-value') for el in xml.findall('.//init-param')
        if el.findtext('.//param-name') == 'autologin.cookie.age'
    ][0] == '1209600'
Exemple #18
0
def test_elasticsearch_default(docker_cli, image, run_user):
    container = run_image(docker_cli, image, user=run_user)
    _jvm = wait_for_proc(container, get_bootstrap_proc(container))

    procs_list = get_procs(container)
    start_bitbucket = [
        proc for proc in procs_list if 'start-bitbucket.sh' in proc
    ][0]
    assert '--no-search' not in start_bitbucket

    _es_jvm = wait_for_proc(container,
                            'org.elasticsearch.bootstrap.Elasticsearch')
Exemple #19
0
def test_application_mode_mirror(docker_cli, image, run_user):
    environment = {'APPLICATION_MODE': 'mirror'}
    container = run_image(docker_cli,
                          image,
                          user=run_user,
                          environment=environment)
    _jvm = wait_for_proc(container, get_bootstrap_proc(container))

    procs_list = get_procs(container)
    start_bitbucket = [
        proc for proc in procs_list if 'start-bitbucket.sh' in proc
    ][0]
    assert '--no-search' in start_bitbucket
Exemple #20
0
def test_elasticsearch_disabled(docker_cli, image, run_user):
    environment = {'ELASTICSEARCH_ENABLED': 'false'}
    container = run_image(docker_cli,
                          image,
                          user=run_user,
                          environment=environment)
    _jvm = wait_for_proc(container, get_bootstrap_proc(container))

    procs_list = get_procs(container)
    start_bitbucket = [
        proc for proc in procs_list if 'start-bitbucket.sh' in proc
    ][0]
    assert '--no-search' in start_bitbucket
def test_seraph_xml_params(docker_cli, image):
    environment = {'ATL_AUTOLOGIN_COOKIE_AGE': '9001'}
    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)}/atlassian-jira/WEB-INF/classes/seraph-config.xml'
    )
    assert [
        el.findtext('.//param-value') for el in xml.findall('.//init-param')
        if el.findtext('.//param-name') == 'autologin.cookie.age'
    ][0] == environment.get('ATL_AUTOLOGIN_COOKIE_AGE')
Exemple #22
0
def test_jvm_support_recommended_args_order(docker_cli, image):
    ENABLE_PRINTGCDETAILS = '-XX:+PrintGCDetails'
    DISABLE_PRINTGCDETAILS = '-XX:-PrintGCDetails'
    environment = {
        'JVM_SUPPORT_RECOMMENDED_ARGS': ENABLE_PRINTGCDETAILS,
    }
    container = run_image(docker_cli, image, environment=environment)
    _jvm = wait_for_proc(container, get_bootstrap_proc(container))

    procs_list = get_procs(container)
    jvm = [
        proc for proc in procs_list if get_bootstrap_proc(container) in proc
    ][0]
    assert jvm.index(ENABLE_PRINTGCDETAILS) > jvm.index(DISABLE_PRINTGCDETAILS)
Exemple #23
0
def test_jvm_args(docker_cli, image, run_user):
    environment = {
        'JVM_MINIMUM_MEMORY': '383m',
        'JVM_MAXIMUM_MEMORY': '2047m',
        'JVM_SUPPORT_RECOMMENDED_ARGS': '-verbose:gc',
    }
    container = run_image(docker_cli, image, user=run_user, environment=environment)
    _jvm = wait_for_proc(container, get_bootstrap_proc(container))
    
    procs_list = get_procs(container)
    jvm = [proc for proc in procs_list if get_bootstrap_proc(container) in proc][0]
    
    assert f'-Xms{environment.get("JVM_MINIMUM_MEMORY")}' in jvm
    assert f'-Xmx{environment.get("JVM_MAXIMUM_MEMORY")}' in jvm
    assert environment.get('JVM_SUPPORT_RECOMMENDED_ARGS') in jvm
def test_server_xml_access_log(docker_cli, image):
    environment = {
        'ATL_TOMCAT_ACCESS_LOG': 'true',
        'ATL_TOMCAT_PROXY_INTERNAL_IPS': '192.168.1.1',
    }

    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')
    valve = xml.find(
        './/Context/Valve[@className="org.apache.catalina.valves.RemoteIpValve"]'
    )
    assert valve.get('internalProxies') == environment.get(
        'ATL_TOMCAT_PROXY_INTERNAL_IPS')
Exemple #25
0
def test_thread_dumps(docker_cli, image, run_user):
    COUNT = 3
    INTERVAL = 1
    container = run_image(docker_cli, image, user=run_user)
    wait_for_proc(container, get_bootstrap_proc(container))
    
    thread_cmd = f'/opt/atlassian/support/thread-dumps.sh --count {COUNT} --interval {INTERVAL}'
    container.run(thread_cmd)
    
    find_thread_cmd = f'find {get_app_home(container)} -name "*_THREADS.*.txt"'
    thread_dumps = container.run(find_thread_cmd).stdout.splitlines()
    assert len(thread_dumps) == COUNT
    
    find_top_cmd = f'find {get_app_home(container)} -name "*_CPU_USAGE.*.txt"'
    top_dumps = container.run(find_top_cmd).stdout.splitlines()
    assert len(top_dumps) == COUNT
def test_server_xml_params(docker_cli, image):
    environment = {
        'ATL_TOMCAT_MGMT_PORT': '8006',
        'ATL_TOMCAT_PORT': '9090',
        'ATL_TOMCAT_MAXTHREADS': '201',
        'ATL_TOMCAT_MINSPARETHREADS': '11',
        'ATL_TOMCAT_CONNECTIONTIMEOUT': '20001',
        'ATL_TOMCAT_ENABLELOOKUPS': 'true',
        'ATL_TOMCAT_PROTOCOL': 'HTTP/2',
        'ATL_TOMCAT_ACCEPTCOUNT': '11',
        'ATL_TOMCAT_SECURE': 'true',
        'ATL_TOMCAT_SCHEME': 'https',
        'ATL_PROXY_NAME': 'conf.atlassian.com',
        'ATL_PROXY_PORT': '443',
        'ATL_TOMCAT_MAXHTTPHEADERSIZE': '8193',
        'ATL_TOMCAT_CONTEXTPATH': '/myconf',
    }
    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')
    connector = xml.find('.//Connector')
    context = xml.find('.//Context')

    assert xml.get('port') == environment.get('ATL_TOMCAT_MGMT_PORT')

    assert connector.get('port') == environment.get('ATL_TOMCAT_PORT')
    assert connector.get('maxThreads') == environment.get(
        'ATL_TOMCAT_MAXTHREADS')
    assert connector.get('minSpareThreads') == environment.get(
        'ATL_TOMCAT_MINSPARETHREADS')
    assert connector.get('connectionTimeout') == environment.get(
        'ATL_TOMCAT_CONNECTIONTIMEOUT')
    assert connector.get('enableLookups') == environment.get(
        'ATL_TOMCAT_ENABLELOOKUPS')
    assert connector.get('protocol') == environment.get('ATL_TOMCAT_PROTOCOL')
    assert connector.get('acceptCount') == environment.get(
        'ATL_TOMCAT_ACCEPTCOUNT')
    assert connector.get('secure') == environment.get('ATL_TOMCAT_SECURE')
    assert connector.get('scheme') == environment.get('ATL_TOMCAT_SCHEME')
    assert connector.get('proxyName') == environment.get('ATL_PROXY_NAME')
    assert connector.get('proxyPort') == environment.get('ATL_PROXY_PORT')
    assert connector.get('maxHttpHeaderSize') == environment.get(
        'ATL_TOMCAT_MAXHTTPHEADERSIZE')

    assert context.get('path') == environment.get('ATL_TOMCAT_CONTEXTPATH')
Exemple #27
0
def test_dbconfig_xml_params(docker_cli, image, run_user):
    environment = {
        'ATL_DB_TYPE': 'postgres72',
        'ATL_DB_DRIVER': 'org.postgresql.Driver',
        'ATL_JDBC_URL': 'jdbc:postgresql://mypostgres.mycompany.org:5432/jiradb',
        'ATL_JDBC_USER': '******',
        'ATL_JDBC_PASSWORD': '******',
        'ATL_DB_SCHEMA_NAME': 'private',
        'ATL_DB_MAXIDLE': '21',
        'ATL_DB_MAXWAITMILLIS': '30001',
        'ATL_DB_MINEVICTABLEIDLETIMEMILLIS': '5001',
        'ATL_DB_MINIDLE': '11',
        'ATL_DB_POOLMAXSIZE': '101',
        'ATL_DB_POOLMINSIZE': '21',
        'ATL_DB_REMOVEABANDONED': 'false',
        'ATL_DB_REMOVEABANDONEDTIMEOUT': '301',
        'ATL_DB_TESTONBORROW': 'true',
        'ATL_DB_TESTWHILEIDLE': 'false',
        'ATL_DB_TIMEBETWEENEVICTIONRUNSMILLIS': '30001',
        'ATL_DB_VALIDATIONQUERY': 'select 2',
    }
    container = run_image(docker_cli, image, user=run_user, environment=environment)
    _jvm = wait_for_proc(container, get_bootstrap_proc(container))

    xml = parse_xml(container, f'{get_app_home(container)}/dbconfig.xml')

    assert xml.findtext('.//database-type') == environment.get('ATL_DB_TYPE')
    assert xml.findtext('.//driver-class') == environment.get('ATL_DB_DRIVER')
    assert xml.findtext('.//url') == environment.get('ATL_JDBC_URL')
    assert xml.findtext('.//username') == environment.get('ATL_JDBC_USER')
    assert xml.findtext('.//password') == environment.get('ATL_JDBC_PASSWORD')
    assert xml.findtext('.//schema-name') == environment.get('ATL_DB_SCHEMA_NAME')

    assert xml.findtext('.//pool-min-size') == environment.get('ATL_DB_POOLMINSIZE')
    assert xml.findtext('.//pool-max-size') == environment.get('ATL_DB_POOLMAXSIZE')
    assert xml.findtext('.//pool-min-idle') == environment.get('ATL_DB_MINIDLE')
    assert xml.findtext('.//pool-max-idle') == environment.get('ATL_DB_MAXIDLE')
    assert xml.findtext('.//pool-max-wait') == environment.get('ATL_DB_MAXWAITMILLIS')
    assert xml.findtext('.//validation-query') == environment.get('ATL_DB_VALIDATIONQUERY')
    assert xml.findtext('.//time-between-eviction-runs-millis') == environment.get('ATL_DB_TIMEBETWEENEVICTIONRUNSMILLIS')
    assert xml.findtext('.//min-evictable-idle-time-millis') == environment.get('ATL_DB_MINEVICTABLEIDLETIMEMILLIS')
    assert xml.findtext('.//pool-remove-abandoned') == environment.get('ATL_DB_REMOVEABANDONED')
    assert xml.findtext('.//pool-remove-abandoned-timeout') == environment.get('ATL_DB_REMOVEABANDONEDTIMEOUT')
    assert xml.findtext('.//pool-test-while-idle') == environment.get('ATL_DB_TESTWHILEIDLE')
    assert xml.findtext('.//pool-test-on-borrow') == environment.get('ATL_DB_TESTONBORROW')
Exemple #28
0
def test_dbconfig_xml_default_schema_names(docker_cli, image, run_user, atl_db_type):
    default_schema_names = {
        'mssql': 'dbo',
        'mysql': 'public',
        'oracle10g': '',
        'postgres72': 'public',
    }
    schema_name = default_schema_names.get(atl_db_type, '')
    
    environment = {
        'ATL_DB_TYPE': atl_db_type,
    }
    container = run_image(docker_cli, image, user=run_user, environment=environment)
    _jvm = wait_for_proc(container, get_bootstrap_proc(container))

    xml = parse_xml(container, f'{get_app_home(container)}/dbconfig.xml')
    
    assert xml.findtext('.//schema-name') == schema_name
def test_confluence_xml_cluster_aws(docker_cli, image, run_user):
    environment = {
        'ATL_CLUSTER_TYPE': 'aws',
        'ATL_HAZELCAST_NETWORK_AWS_IAM_ROLE':
        'atl_hazelcast_network_aws_iam_role',
        'ATL_HAZELCAST_NETWORK_AWS_IAM_REGION':
        'atl_hazelcast_network_aws_iam_region',
        'ATL_HAZELCAST_NETWORK_AWS_HOST_HEADER':
        'atl_hazelcast_network_aws_host_header',
        'ATL_HAZELCAST_NETWORK_AWS_TAG_KEY':
        'atl_hazelcast_network_aws_tag_key',
        'ATL_HAZELCAST_NETWORK_AWS_TAG_VALUE':
        'atl_hazelcast_network_aws_tag_value',
        'ATL_CLUSTER_NAME': 'atl_cluster_name',
        'ATL_CLUSTER_TTL': 'atl_cluster_ttl'
    }
    container = run_image(docker_cli,
                          image,
                          user=run_user,
                          environment=environment)
    _jvm = wait_for_proc(container, get_bootstrap_proc(container))

    xml = parse_xml(container, f'{get_app_home(container)}/confluence.cfg.xml')

    assert xml.findall(
        './/property[@name="confluence.cluster"]')[0].text == "true"
    assert xml.findall(
        './/property[@name="confluence.cluster.join.type"]')[0].text == "aws"

    assert xml.findall('.//property[@name="confluence.cluster.aws.iam.role"]'
                       )[0].text == "atl_hazelcast_network_aws_iam_role"
    assert xml.findall('.//property[@name="confluence.cluster.aws.region"]'
                       )[0].text == "atl_hazelcast_network_aws_iam_region"
    assert xml.findall(
        './/property[@name="confluence.cluster.aws.host.header"]'
    )[0].text == "atl_hazelcast_network_aws_host_header"
    assert xml.findall('.//property[@name="confluence.cluster.aws.tag.key"]'
                       )[0].text == "atl_hazelcast_network_aws_tag_key"
    assert xml.findall('.//property[@name="confluence.cluster.aws.tag.value"]'
                       )[0].text == "atl_hazelcast_network_aws_tag_value"
    assert xml.findall('.//property[@name="confluence.cluster.name"]'
                       )[0].text == "atl_cluster_name"
    assert xml.findall('.//property[@name="confluence.cluster.ttl"]'
                       )[0].text == "atl_cluster_ttl"
def test_confluence_xml_postgres(docker_cli, image, run_user):
    environment = {
        'ATL_DB_TYPE': 'postgresql',
        'ATL_JDBC_URL': 'atl_jdbc_url',
        'ATL_JDBC_USER': '******',
        'ATL_JDBC_PASSWORD': '******'
    }
    container = run_image(docker_cli,
                          image,
                          user=run_user,
                          environment=environment)
    _jvm = wait_for_proc(container, get_bootstrap_proc(container))

    xml = parse_xml(container, f'{get_app_home(container)}/confluence.cfg.xml')
    assert xml.findall('.//property[@name="hibernate.connection.url"]'
                       )[0].text == "atl_jdbc_url"
    assert xml.findall('.//property[@name="hibernate.connection.username"]'
                       )[0].text == "atl_jdbc_user"
    assert xml.findall('.//property[@name="hibernate.connection.password"]'
                       )[0].text == "atl_jdbc_password"
    assert xml.findall('.//property[@name="confluence.database.choice"]'
                       )[0].text == "postgresql"
    assert xml.findall(
        './/property[@name="hibernate.dialect"]'
    )[0].text == "com.atlassian.confluence.impl.hibernate.dialect.PostgreSQLDialect"
    assert xml.findall('.//property[@name="hibernate.connection.driver_class"]'
                       )[0].text == "org.postgresql.Driver"

    assert xml.findall(
        './/property[@name="hibernate.c3p0.min_size"]')[0].text == "20"
    assert xml.findall(
        './/property[@name="hibernate.c3p0.max_size"]')[0].text == "100"
    assert xml.findall(
        './/property[@name="hibernate.c3p0.timeout"]')[0].text == "30"
    assert xml.findall('.//property[@name="hibernate.c3p0.idle_test_period"]'
                       )[0].text == "100"
    assert xml.findall(
        './/property[@name="hibernate.c3p0.max_statements"]')[0].text == "0"
    assert xml.findall(
        './/property[@name="hibernate.c3p0.validate"]')[0].text == "false"
    assert xml.findall(
        './/property[@name="hibernate.c3p0.acquire_increment"]')[0].text == "1"
    assert xml.findall('.//property[@name="hibernate.c3p0.preferredTestQuery"]'
                       )[0].text == "select 1"