Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
BertrandGouny committed Sep 2, 2016
1 parent 322f478 commit 4fd7464
Showing 1 changed file with 1 addition and 33 deletions.
34 changes: 1 addition & 33 deletions test/test_helper.bash
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,10 @@ clear_container() {
remove_containers_by_cid $CONTAINER_ID
}

is_service_running() {
is_service_running_by_cid $CONTAINER_ID $1
}

is_file_exists() {
is_file_exists_by_cid $CONTAINER_ID $1
}

wait_process() {
wait_process_by_cid $CONTAINER_ID $@
}


# generic functions
get_container_ip_by_cid() {
local IP=$(docker inspect -f "{{ .NetworkSettings.IPAddress }}" $1)
Expand Down Expand Up @@ -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_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}
}

0 comments on commit 4fd7464

Please sign in to comment.