From f4e63ef33fd0e447d4a5e8e862baf3b82f825972 Mon Sep 17 00:00:00 2001 From: Wang Qi Date: Fri, 22 May 2026 14:45:09 +0800 Subject: [PATCH] Refactor: enahnce CI (#15147) ### What problem does this PR solve? Refactor: enahnce CI ### Type of change - [x] Refactoring --- .github/workflows/tests.yml | 84 +++++++++++++++++++++++++++++++------ 1 file changed, 72 insertions(+), 12 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 29fbc5886..f14cf502c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -233,20 +233,40 @@ jobs: - name: Run sdk tests against Infinity run: | export http_proxy=""; export https_proxy=""; export no_proxy=""; export HTTP_PROXY=""; export HTTPS_PROXY=""; export NO_PROXY="" - until sudo docker exec ${RAGFLOW_CONTAINER} curl -s --connect-timeout 5 ${HOST_ADDRESS}/v1/system/ping > /dev/null 2>&1; do - echo "Waiting for service to be available... (last exit code: $?)" + svc_ready=0 + for i in $(seq 1 60); do + if sudo docker exec ${RAGFLOW_CONTAINER} curl -s --connect-timeout 5 ${HOST_ADDRESS}/api/v1/system/ping > /dev/null 2>&1; then + svc_ready=1 + break + fi + echo "Waiting for service to be available... ($i/120)" sleep 5 done + if [ "$svc_ready" -ne 1 ]; then + echo "Service did not become ready after 5 minutes. Docker logs:" + sudo docker logs ${RAGFLOW_CONTAINER} + exit 1 + fi echo "Start to run test sdk on Infinity" source .venv/bin/activate && set -o pipefail; DOC_ENGINE=infinity pytest -s --tb=short --level=${HTTP_API_TEST_LEVEL} --junitxml=pytest-infinity-sdk.xml --cov=sdk/python/ragflow_sdk --cov-branch --cov-report=xml:coverage-infinity-sdk.xml test/testcases/test_sdk_api 2>&1 | tee infinity_sdk_test.log - name: Run New RESTFUL api tests against Infinity run: | export http_proxy=""; export https_proxy=""; export no_proxy=""; export HTTP_PROXY=""; export HTTPS_PROXY=""; export NO_PROXY="" - until sudo docker exec ${RAGFLOW_CONTAINER} curl -s --connect-timeout 5 ${HOST_ADDRESS}/v1/system/ping > /dev/null 2>&1; do - echo "Waiting for service to be available... (last exit code: $?)" + svc_ready=0 + for i in $(seq 1 60); do + if sudo docker exec ${RAGFLOW_CONTAINER} curl -s --connect-timeout 5 ${HOST_ADDRESS}/api/v1/system/ping > /dev/null 2>&1; then + svc_ready=1 + break + fi + echo "Waiting for service to be available... ($i/120)" sleep 5 done + if [ "$svc_ready" -ne 1 ]; then + echo "Service did not become ready after 5 minutes. Docker logs:" + sudo docker logs ${RAGFLOW_CONTAINER} + exit 1 + fi source .venv/bin/activate && set -o pipefail; DOC_ENGINE=infinity pytest -s --tb=short --level=${HTTP_API_TEST_LEVEL} test/testcases/restful_api 2>&1 | tee infinity_restful_api_test.log - name: RAGFlow CLI retrieval test Infinity @@ -309,10 +329,20 @@ jobs: ADMIN_HOST="${USER_HOST}" ADMIN_PORT="${ADMIN_SVR_HTTP_PORT}" - until sudo docker exec ${RAGFLOW_CONTAINER} curl -s --connect-timeout 5 ${HOST_ADDRESS}/v1/system/ping > /dev/null 2>&1; do - echo "Waiting for service to be available... (last exit code: $?)" + svc_ready=0 + for i in $(seq 1 60); do + if sudo docker exec ${RAGFLOW_CONTAINER} curl -s --connect-timeout 5 ${HOST_ADDRESS}/api/v1/system/ping > /dev/null 2>&1; then + svc_ready=1 + break + fi + echo "Waiting for service to be available... ($i/120)" sleep 5 done + if [ "$svc_ready" -ne 1 ]; then + echo "Service did not become ready after 5 minutes. Docker logs:" + sudo docker logs ${RAGFLOW_CONTAINER} + exit 1 + fi admin_ready=0 for i in $(seq 1 30); do @@ -417,20 +447,40 @@ jobs: - name: Run sdk tests against Elasticsearch run: | export http_proxy=""; export https_proxy=""; export no_proxy=""; export HTTP_PROXY=""; export HTTPS_PROXY=""; export NO_PROXY="" - until sudo docker exec ${RAGFLOW_CONTAINER} curl -s --connect-timeout 5 ${HOST_ADDRESS}/v1/system/ping > /dev/null 2>&1; do - echo "Waiting for service to be available... (last exit code: $?)" + svc_ready=0 + for i in $(seq 1 60); do + if sudo docker exec ${RAGFLOW_CONTAINER} curl -s --connect-timeout 5 ${HOST_ADDRESS}/api/v1/system/ping > /dev/null 2>&1; then + svc_ready=1 + break + fi + echo "Waiting for service to be available... ($i/120)" sleep 5 done + if [ "$svc_ready" -ne 1 ]; then + echo "Service did not become ready after 5 minutes. Docker logs:" + sudo docker logs ${RAGFLOW_CONTAINER} + exit 1 + fi echo "Start to run test sdk on Elasticsearch" source .venv/bin/activate && set -o pipefail; pytest -s --tb=short --level=${HTTP_API_TEST_LEVEL} --junitxml=pytest-infinity-sdk.xml --cov=sdk/python/ragflow_sdk --cov-branch --cov-report=xml:coverage-es-sdk.xml test/testcases/test_sdk_api 2>&1 | tee es_sdk_test.log - name: Run New RESTFUL api tests against Elasticsearch run: | export http_proxy=""; export https_proxy=""; export no_proxy=""; export HTTP_PROXY=""; export HTTPS_PROXY=""; export NO_PROXY="" - until sudo docker exec ${RAGFLOW_CONTAINER} curl -s --connect-timeout 5 ${HOST_ADDRESS}/v1/system/ping > /dev/null 2>&1; do - echo "Waiting for service to be available... (last exit code: $?)" + svc_ready=0 + for i in $(seq 1 60); do + if sudo docker exec ${RAGFLOW_CONTAINER} curl -s --connect-timeout 5 ${HOST_ADDRESS}/api/v1/system/ping > /dev/null 2>&1; then + svc_ready=1 + break + fi + echo "Waiting for service to be available... ($i/120)" sleep 5 done + if [ "$svc_ready" -ne 1 ]; then + echo "Service did not become ready after 5 minutes. Docker logs:" + sudo docker logs ${RAGFLOW_CONTAINER} + exit 1 + fi source .venv/bin/activate && set -o pipefail; pytest -s --tb=short --level=${HTTP_API_TEST_LEVEL} test/testcases/restful_api 2>&1 | tee es_restful_api_test.log - name: RAGFlow CLI retrieval test Elasticsearch @@ -493,10 +543,20 @@ jobs: ADMIN_HOST="${USER_HOST}" ADMIN_PORT="${ADMIN_SVR_HTTP_PORT}" - until sudo docker exec ${RAGFLOW_CONTAINER} curl -s --connect-timeout 5 ${HOST_ADDRESS}/v1/system/ping > /dev/null 2>&1; do - echo "Waiting for service to be available... (last exit code: $?)" + svc_ready=0 + for i in $(seq 1 60); do + if sudo docker exec ${RAGFLOW_CONTAINER} curl -s --connect-timeout 5 ${HOST_ADDRESS}/api/v1/system/ping > /dev/null 2>&1; then + svc_ready=1 + break + fi + echo "Waiting for service to be available... ($i/120)" sleep 5 done + if [ "$svc_ready" -ne 1 ]; then + echo "Service did not become ready after 5 minutes. Docker logs:" + sudo docker logs ${RAGFLOW_CONTAINER} + exit 1 + fi admin_ready=0 for i in $(seq 1 30); do