Merged in DCKUBE-36-clean-shutdown (pull request #96)

DCKUBE-36 clean shutdown

Approved-by: Minh Tran
Approved-by: Dylan Rathbone
This commit is contained in:
Steve Smith 2021-05-17 04:37:04 +00:00
commit 0afb048b64
2 changed files with 20 additions and 7 deletions

View File

@ -1,6 +1,6 @@
#!/usr/bin/python3 -B
from entrypoint_helpers import env, gen_cfg, str2bool, start_app
from entrypoint_helpers import env, gen_cfg, str2bool, exec_app
RUN_USER = env['run_user']
@ -16,4 +16,4 @@ gen_cfg('confluence-init.properties.j2',
gen_cfg('confluence.cfg.xml.j2', f'{CONFLUENCE_HOME}/confluence.cfg.xml',
user=RUN_USER, group=RUN_GROUP, overwrite=False)
start_app(f'{CONFLUENCE_INSTALL_DIR}/bin/start-confluence.sh -fg', CONFLUENCE_HOME, name='Confluence')
exec_app([f'{CONFLUENCE_INSTALL_DIR}/bin/start-confluence.sh', '-fg'], CONFLUENCE_HOME, name='Confluence')

View File

@ -1,8 +1,13 @@
import pytest
import signal
import testinfra
from helpers import get_app_home, get_app_install_dir, get_bootstrap_proc, get_procs, \
parse_properties, parse_xml, run_image, wait_for_http_response, wait_for_proc
parse_properties, parse_xml, run_image, \
wait_for_http_response, wait_for_proc, wait_for_state, wait_for_log
PORT = 8090
STATUS_URL = f'http://localhost:{PORT}/status'
def test_jvm_args(docker_cli, image, run_user):
@ -35,12 +40,20 @@ def test_install_permissions(docker_cli, image):
def test_first_run_state(docker_cli, image, run_user):
PORT = 8090
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'), max_wait=120)
wait_for_http_response(STATUS_URL, expected_status=200, expected_state=('STARTING', 'FIRST_RUN'), max_wait=120)
def test_clean_shutdown(docker_cli, image, run_user):
container = docker_cli.containers.run(image, detach=True, user=run_user, ports={PORT: PORT})
host = testinfra.get_host("docker://"+container.id)
wait_for_state(STATUS_URL, expected_state='FIRST_RUN')
container.kill(signal.SIGTERM)
end = r'org\.apache\.coyote\.AbstractProtocol\.destroy Destroying ProtocolHandler'
wait_for_log(container, end)
def test_server_xml_defaults(docker_cli, image):