DCKUBE-36: Add test for clean shutdown.

This commit is contained in:
Steve Smith 2021-05-05 13:11:09 +10:00
parent f2483482dc
commit ad4acc355a

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):