mirror of
https://github.com/azaion/detections.git
synced 2026-06-23 13:21:08 +00:00
Changed smoke-test to wait AI conversion
ci/woodpecker/manual/e2e-smoke-jetson Pipeline was canceled
ci/woodpecker/manual/e2e-smoke-jetson Pipeline was canceled
This commit is contained in:
+8
-1
@@ -19,6 +19,13 @@ case "$PROFILE" in
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
COMPOSE="docker compose -f docker-compose.test.yml --profile $PROFILE"
|
COMPOSE="docker compose -f docker-compose.test.yml --profile $PROFILE"
|
||||||
|
RUNNER_ENV_ARGS=(-e E2E_PROFILE="$PROFILE")
|
||||||
|
if [[ "$PROFILE" == "jetson" ]]; then
|
||||||
|
RUNNER_ENV_ARGS+=(
|
||||||
|
-e E2E_WAIT_FOR_ENGINE_ENABLED="${E2E_WAIT_FOR_ENGINE_ENABLED:-1}"
|
||||||
|
-e E2E_ENGINE_WAIT_TIMEOUT="${E2E_ENGINE_WAIT_TIMEOUT:-900}"
|
||||||
|
)
|
||||||
|
fi
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo "Usage: $0 <test_path> [pytest_args...]"
|
echo "Usage: $0 <test_path> [pytest_args...]"
|
||||||
@@ -54,7 +61,7 @@ done
|
|||||||
|
|
||||||
echo "--- Running: pytest $* -v -x -s --csv=/results/report.csv"
|
echo "--- Running: pytest $* -v -x -s --csv=/results/report.csv"
|
||||||
set +e
|
set +e
|
||||||
$COMPOSE run --rm --build --no-deps e2e-runner pytest "$@" -v -x -s --csv=/results/report.csv
|
$COMPOSE run --rm --build --no-deps "${RUNNER_ENV_ARGS[@]}" e2e-runner pytest "$@" -v -x -s --csv=/results/report.csv
|
||||||
EXIT_CODE=$?
|
EXIT_CODE=$?
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import json
|
import json
|
||||||
|
import os
|
||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
import uuid
|
import uuid
|
||||||
@@ -7,6 +8,13 @@ import pytest
|
|||||||
import sseclient
|
import sseclient
|
||||||
|
|
||||||
_DETECT_TIMEOUT = 60
|
_DETECT_TIMEOUT = 60
|
||||||
|
_ENGINE_WAIT_TIMEOUT = int(os.environ.get("E2E_ENGINE_WAIT_TIMEOUT", "900"))
|
||||||
|
_WAIT_FOR_ENGINE_ENABLED = os.environ.get("E2E_WAIT_FOR_ENGINE_ENABLED", "").lower() in (
|
||||||
|
"1",
|
||||||
|
"true",
|
||||||
|
"yes",
|
||||||
|
"on",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def _get_health(http_client):
|
def _get_health(http_client):
|
||||||
@@ -20,6 +28,24 @@ def _assert_active_ai(data):
|
|||||||
assert data["aiAvailability"] not in ("None", "Downloading")
|
assert data["aiAvailability"] not in ("None", "Downloading")
|
||||||
|
|
||||||
|
|
||||||
|
def _wait_for_engine_enabled(http_client):
|
||||||
|
deadline = time.time() + _ENGINE_WAIT_TIMEOUT
|
||||||
|
last = None
|
||||||
|
while time.time() < deadline:
|
||||||
|
last = _get_health(http_client)
|
||||||
|
availability = last.get("aiAvailability")
|
||||||
|
if availability == "Enabled":
|
||||||
|
assert last.get("errorMessage") is None
|
||||||
|
return last
|
||||||
|
if availability == "Error":
|
||||||
|
pytest.fail(f"engine conversion failed: {last.get('errorMessage')}")
|
||||||
|
time.sleep(3)
|
||||||
|
pytest.fail(
|
||||||
|
f"engine did not become Enabled within {_ENGINE_WAIT_TIMEOUT}s "
|
||||||
|
f"(last health: {last})"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.cpu
|
@pytest.mark.cpu
|
||||||
class TestHealthEngineStep01PreInit:
|
class TestHealthEngineStep01PreInit:
|
||||||
def test_ft_p_01_pre_init_health(self, http_client):
|
def test_ft_p_01_pre_init_health(self, http_client):
|
||||||
@@ -92,7 +118,11 @@ class TestHealthEngineStep03Warmed:
|
|||||||
def _warm(self, warm_engine):
|
def _warm(self, warm_engine):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@pytest.mark.timeout(_ENGINE_WAIT_TIMEOUT + 30)
|
||||||
def test_ft_p_02_post_init_health(self, http_client):
|
def test_ft_p_02_post_init_health(self, http_client):
|
||||||
|
if _WAIT_FOR_ENGINE_ENABLED:
|
||||||
|
data = _wait_for_engine_enabled(http_client)
|
||||||
|
else:
|
||||||
data = _get_health(http_client)
|
data = _get_health(http_client)
|
||||||
_assert_active_ai(data)
|
_assert_active_ai(data)
|
||||||
assert data.get("errorMessage") is None
|
assert data.get("errorMessage") is None
|
||||||
|
|||||||
Reference in New Issue
Block a user