Files
admin/scripts/run-performance-tests.sh
2026-04-16 06:25:36 +03:00

44 lines
1.3 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
cleanup() {
echo "Cleaning up..."
docker compose -f "$PROJECT_ROOT/docker-compose.test.yml" down -v --remove-orphans 2>/dev/null || true
}
trap cleanup EXIT
echo "=== Starting system under test ==="
docker compose -f "$PROJECT_ROOT/docker-compose.test.yml" up -d system-under-test test-db
echo "=== Waiting for system to be ready ==="
MAX_WAIT=30
WAIT=0
until curl -sf http://localhost:8080/swagger/index.html > /dev/null 2>&1 || [ $WAIT -ge $MAX_WAIT ]; do
sleep 1
WAIT=$((WAIT + 1))
done
if [ $WAIT -ge $MAX_WAIT ]; then
echo "ERROR: System did not become ready within ${MAX_WAIT}s"
exit 1
fi
echo "=== Running performance tests ==="
echo "Performance test runner not yet configured."
echo "Install k6, locust, or artillery and add load scenarios from:"
echo " _docs/02_document/tests/performance-tests.md"
echo ""
echo "Example with k6:"
echo " k6 run scripts/perf-scenarios.js"
echo ""
echo "Thresholds from test spec:"
echo " NFT-PERF-01: Login p95 < 500ms"
echo " NFT-PERF-02: Small file download p95 < 1000ms"
echo " NFT-PERF-03: Large file download p95 < 30000ms"
echo " NFT-PERF-04: User list p95 < 1000ms"
echo "=== Performance test scaffolding complete ==="