Files
detections/e2e/run_test.sh
T
Roman Meshko 6ad4b700dd
ci/woodpecker/push/02-build-push Pipeline was successful
Feature/run jetson e2e tests (#4)
* Run tests

* Run tests

* Run tests

* Run tests

* Added rebuild

* Added files for e2e tests

* Added rebuild

* Added rebuild

* Added biuld TensorRT flag

* Changed to use NumPy 1.x for Jetson

* Make universal invocation

* Make Cython constans

* Changed to prepare onnx

* Changed smoke-test to wait AI conversion

* Added step for model conversion

* Changed to not run step in parallel

* Push model to docker registry

* Push model to docker registry

* Push model to docker registry
2026-05-05 21:44:51 +03:00

73 lines
2.1 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
PROFILE="${E2E_PROFILE:-cpu}"
case "$PROFILE" in
cpu)
DETECTIONS_SERVICE="detections"
;;
gpu)
DETECTIONS_SERVICE="detections-gpu"
;;
jetson)
DETECTIONS_SERVICE="detections-jetson"
;;
*)
echo "ERROR: unsupported E2E_PROFILE=$PROFILE (expected: cpu, gpu, jetson)"
exit 2
;;
esac
COMPOSE="docker compose -f docker-compose.test.yml --profile $PROFILE"
LOG_TAIL="${E2E_LOG_TAIL:-100}"
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:-0}"
-e E2E_ENGINE_WAIT_TIMEOUT="${E2E_ENGINE_WAIT_TIMEOUT:-900}"
)
fi
usage() {
echo "Usage: $0 <test_path> [pytest_args...]"
echo ""
echo "Examples:"
echo " $0 tests/test_video.py # run all tests in file"
echo " $0 tests/test_video.py::test_ft_p_10_frame_sampling_ac1 # run single test"
echo " $0 tests/test_video.py -k 'frame_sampling' # run by keyword"
echo ""
echo "Environment:"
echo " E2E_PROFILE=cpu|gpu|jetson compose profile to run (default: cpu)"
echo ""
echo "Flags -v -x -s are always included."
exit 1
}
[[ $# -lt 1 ]] && usage
$COMPOSE up -d --build "$DETECTIONS_SERVICE"
echo "--- Waiting for detections service to become healthy..."
for i in $(seq 1 60); do
if $COMPOSE exec -T "$DETECTIONS_SERVICE" python3 -c "import urllib.request; urllib.request.urlopen('http://localhost:8080/health')" 2>/dev/null; then
echo "--- Detections service is healthy"
break
fi
if [[ "$i" == "60" ]]; then
echo "ERROR: detections service did not become healthy"
$COMPOSE logs "$DETECTIONS_SERVICE" --tail "$LOG_TAIL"
exit 1
fi
sleep 2
done
echo "--- Running: pytest $* -v -x -s --csv=/results/report.csv"
set +e
$COMPOSE run --rm --build --no-deps "${RUNNER_ENV_ARGS[@]}" e2e-runner pytest "$@" -v -x -s --csv=/results/report.csv
EXIT_CODE=$?
set -e
echo "--- Test finished with exit code $EXIT_CODE"
echo "--- Detections logs (last $LOG_TAIL lines):"
$COMPOSE logs "$DETECTIONS_SERVICE" --tail "$LOG_TAIL"
exit $EXIT_CODE