From 56b686c9cdc5b1c11b400a3436e12815624feb16 Mon Sep 17 00:00:00 2001 From: ofreax Date: Fri, 2 Sep 2016 20:56:07 +0200 Subject: [PATCH] test --- test/test_helper.bash | 40 ++++------------------------------------ 1 file changed, 4 insertions(+), 36 deletions(-) diff --git a/test/test_helper.bash b/test/test_helper.bash index 676eefe..2297afa 100644 --- a/test/test_helper.bash +++ b/test/test_helper.bash @@ -30,19 +30,10 @@ clear_container() { remove_containers_by_cid $CONTAINER_ID } -is_service_running() { - is_service_running_by_cid $CONTAINER_ID $1 +wait_process() { + wait_process_by_cid $CONTAINER_ID $@ } -is_file_exists() { - is_file_exists_by_cid $CONTAINER_ID $1 -} - -wait_service() { - wait_service_by_cid $CONTAINER_ID $@ -} - - # generic functions get_container_ip_by_cid() { local IP=$(docker inspect -f "{{ .NetworkSettings.IPAddress }}" $1) @@ -78,30 +69,7 @@ clear_containers_by_cid() { remove_containers_by_cid $@ } -is_service_running_by_cid() { - docker exec $1 ps cax | grep $2 > /dev/null -} - -is_file_exists_by_cid() { - docker exec $1 cat $2 > /dev/null 2>&1 -} - -wait_service_by_cid() { - +wait_process_by_cid() { cid=$1 - - # first wait image init end - while ! is_file_exists_by_cid $cid /container/run/state/startup-done - do - sleep 0.5 - done - - for service in "${@:2}" - do - # wait service - while ! is_service_running_by_cid $cid $service - do - sleep 0.5 - done - done + docker exec $cid /container/tool/wait-process ${@:2} }