66 lines
1.5 KiB
Bash
66 lines
1.5 KiB
Bash
#!/bin/bash
|
|
|
|
#########################################################
|
|
# --- TEST ---
|
|
# Testing selected tests or all.
|
|
#
|
|
# Creating a report.
|
|
#########################################################
|
|
|
|
set -euo pipefail
|
|
|
|
cd "$(dirname "$0")/.."
|
|
|
|
TESTS=${1:-"*"}
|
|
REPORT_DIR="tests/reports"
|
|
mkdir -p "$REPORT_DIR"
|
|
TIMESTAMP=$(date +"%Y%m%d_%H%M%S")
|
|
|
|
start_services() {
|
|
echo "Starting services..."
|
|
docker compose up backend -d --build > /dev/null 2>&1
|
|
echo "All services OK!"
|
|
}
|
|
|
|
stop_services() {
|
|
echo "Stopping services..."
|
|
docker compose down
|
|
echo "All services STOP!"
|
|
}
|
|
|
|
case $TESTS in
|
|
unit)
|
|
pytest tests/unit/ -v
|
|
;;
|
|
integration)
|
|
pytest tests/integration/ -v
|
|
;;
|
|
e2e)
|
|
start_services
|
|
pytest tests/e2e/ -v -s -m e2e || true
|
|
stop_services
|
|
;;
|
|
evals)
|
|
export MODEL=${2:-"qwen3-235b"}
|
|
start_services
|
|
pytest tests/evals/test_scenarios.py -v -s -m evals --tb=short || true
|
|
stop_services
|
|
;;
|
|
all)
|
|
start_services
|
|
pytest tests/ -v -s || true
|
|
stop_services
|
|
;;
|
|
report)
|
|
start_services
|
|
pytest tests/unit/ tests/integration/ tests/e2e/ \
|
|
-v -s --tb=short \
|
|
--template=html1/index.html \
|
|
--report="$REPORT_DIR/report_${TIMESTAMP}.html" || true
|
|
stop_services
|
|
;;
|
|
*)
|
|
echo "Usage: ./testctl.sh [unit|integration|e2e|all]";
|
|
exit 1
|
|
;;
|
|
esac |