This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
services:
|
||||
sos:
|
||||
image: gitea.jde.nz/public/simple-object-storage:test
|
||||
container_name: sos-test
|
||||
ports:
|
||||
- 7703:80
|
||||
volumes:
|
||||
@@ -9,7 +10,7 @@ services:
|
||||
- SOS_CONFIG=/data/sos_config.json
|
||||
restart: no
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:7703/status"]
|
||||
test: ["CMD", "wget", "-qO-", "http://0.0.0.0/status"]
|
||||
interval: 1s
|
||||
timeout: 1s
|
||||
retries: 3
|
||||
|
@@ -15,6 +15,28 @@ function title() {
|
||||
echo "----------------------------------------"
|
||||
}
|
||||
|
||||
|
||||
function wait_for_container {
|
||||
container_id="$1"
|
||||
container_name="$(docker inspect "${container_id}" --format '{{ .Name }}')"
|
||||
echo "Waiting for container: ${container_name} [${container_id}]"
|
||||
waiting_done="false"
|
||||
while [[ "${waiting_done}" != "true" ]]; do
|
||||
container_state="$(docker inspect "${container_id}" --format '{{ .State.Status }}')"
|
||||
if [[ "${container_state}" == "running" ]]; then
|
||||
health_status="$(docker inspect "${container_id}" --format '{{ .State.Health.Status }}')"
|
||||
echo "${container_name}: container_state=${container_state}, health_status=${health_status}"
|
||||
if [[ ${health_status} == "healthy" ]]; then
|
||||
waiting_done="true"
|
||||
fi
|
||||
else
|
||||
echo "${container_name}: container_state=${container_state}"
|
||||
waiting_done="true"
|
||||
fi
|
||||
sleep 1;
|
||||
done;
|
||||
}
|
||||
|
||||
#------------------------------------------------------------------------------------------------
|
||||
# build the executable
|
||||
title "Building amd64 executable"
|
||||
@@ -54,6 +76,8 @@ docker compose -f "${COMPOSE_FILE}" rm -v
|
||||
|
||||
docker compose -f "${COMPOSE_FILE}" up -d
|
||||
|
||||
# wait until healthy.
|
||||
wait_for_container "sos-test"
|
||||
|
||||
"${SCRIPT_DIR}/test.sh" "http://localhost:7703"
|
||||
RESULT=$?
|
||||
|
Reference in New Issue
Block a user