diff --git a/.github/workflows/server-test.yml b/.github/workflows/server-test.yml index 74c9b9a2f..c39e5dd1d 100644 --- a/.github/workflows/server-test.yml +++ b/.github/workflows/server-test.yml @@ -46,6 +46,6 @@ jobs: id: server_integration_test run: | cd examples/server/tests - ./tests.sh tinyllama-2-1b-miniguanaco.Q2_K.gguf + ./tests.sh ../../../tinyllama-2-1b-miniguanaco.Q2_K.gguf diff --git a/examples/server/tests/tests.sh b/examples/server/tests/tests.sh index 36297e9db..d3d414cd3 100755 --- a/examples/server/tests/tests.sh +++ b/examples/server/tests/tests.sh @@ -6,7 +6,6 @@ then exit 1 fi -# kill the server at the end cleanup() { pkill -P $$ } @@ -31,5 +30,16 @@ set -eu --cont-batching \ "$@" & +# Wait for the server to start +max_attempts=30 +attempts=${max_attempts} +until curl --silent --fail "http://localhost:8080/health" | jq -r '.status' | grep ok; do + attempts=$(( attempts - 1)); + [ "${attempts}" -eq 0 ] && { echo "Server did not startup" >&2; exit 1; } + sleep_time=$(( (max_attempts - attempts) * 2 )) + echo "waiting for server to be ready ${sleep_time}s..." + sleep ${sleep_time} +done + # Start tests behave \ No newline at end of file