test
This commit is contained in:
parent
5028b568eb
commit
56b686c9cd
|
@ -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}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue