Files
dance-lessons-coach/scripts/test-all-features-parallel.sh
Gabriel Radureau a75f87777b 🧪 test: add BDD exclusion tags and mark JWT scenarios as todo
- Add @flaky, @todo, @skip tags to BDD_TAGS.md
- Modify all feature test suites to exclude these tags
- Update test scripts to exclude tagged scenarios
- Mark all JWT scenarios with pending steps as @todo

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-04-10 09:09:34 +02:00

99 lines
2.9 KiB
Bash
Executable File

#!/bin/bash
# Parallel Feature Test Runner Script
# Runs multiple feature tests in parallel with proper isolation
set -e
SCRIPTS_DIR=$(dirname `realpath ${BASH_SOURCE[0]}`)
cd $SCRIPTS_DIR/..
echo "🚀 Parallel Feature Test Runner"
echo "================================"
echo
# Define features and their ports
declare -a features=(
"auth:9192"
"config:9193"
"greet:9194"
"health:9195"
"jwt:9196"
)
# Function to run a single feature test
run_feature_test() {
local feature_port="$1"
local feature_name="$2"
local port="$3"
echo "🧪 Starting ${feature_name} feature tests on port ${port}..."
# Set feature-specific environment variables
export DLC_DATABASE_HOST="localhost"
export DLC_DATABASE_PORT="5432"
export DLC_DATABASE_USER="postgres"
export DLC_DATABASE_PASSWORD="postgres"
export DLC_DATABASE_NAME="dance_lessons_coach_${feature_name}_test"
export DLC_DATABASE_SSL_MODE="disable"
# Create feature-specific database using docker
if ! docker exec dance-lessons-coach-postgres psql -U postgres -lqt | cut -d \| -f 1 | grep -qw "${DLC_DATABASE_NAME}"; then
echo "📦 Creating ${feature_name} test database..."
docker exec dance-lessons-coach-postgres createdb -U postgres "${DLC_DATABASE_NAME}"
fi
# Run the feature tests with tag exclusion
cd "features/${feature_name}"
FEATURE=${feature_name} DLC_DATABASE_NAME="${DLC_DATABASE_NAME}" go test -v . -tags="~@flaky && ~@todo && ~@skip" 2>&1 | grep -E "(PASS|FAIL|RUN)" || true
# Cleanup
cd ../..
docker exec dance-lessons-coach-postgres dropdb -U postgres "${DLC_DATABASE_NAME}" 2>/dev/null || true
echo "${feature_name} feature tests completed"
}
# Check if PostgreSQL is running
if ! docker ps --format '{{.Names}}' | grep -q "^dance-lessons-coach-postgres$"; then
echo "❌ PostgreSQL container is not running. Please start PostgreSQL first."
echo "💡 Try: docker compose up -d postgres"
exit 1
fi
# Check if PostgreSQL is ready
max_attempts=10
attempt=0
while [ $attempt -lt $max_attempts ]; do
if docker exec dance-lessons-coach-postgres pg_isready -U postgres 2>/dev/null; then
break
fi
attempt=$((attempt + 1))
sleep 1
done
if [ $attempt -eq $max_attempts ]; then
echo "❌ PostgreSQL is not ready. Please check the container logs."
exit 1
fi
echo "✅ PostgreSQL is ready for parallel testing"
echo
# Run feature tests in parallel
for feature_port in "${features[@]}"; do
# Split feature:port into separate variables
IFS=':' read -r feature_name port <<< "${feature_port}"
# Run test in background
run_feature_test "${feature_port}" "${feature_name}" "${port}" &
done
# Wait for all background processes to complete
wait
echo
echo "🎉 All parallel feature tests completed!"
echo "📊 Check individual feature test outputs above for results"