Files
karaoke-gen/scripts/stop-emulators.sh
T
Andrew Beveridge 7cbde5acca Add comprehensive emulator-based integration testing
- Implement 11 emulator integration tests (Firestore + GCS)
- Add emulator management scripts (start/stop/run-tests)
- Fix module-level mock isolation issues
- Add TEST_SERVER_URL support for worker service routing
- Create comprehensive testing documentation
- All 73 tests passing (62 unit + 11 emulator integration)

Benefits:
- 2s test runtime vs 10+ min for cloud tests
- Zero cloud costs for testing
- Tests use real Firestore/GCS emulators
- Caught bugs unit tests missed (e.g. input_media_gcs_path)

Test Results:
✅ Unit Tests: 62 passed (0.4s)
✅ Emulator Tests: 11 passed (2.0s)
2025-12-01 20:32:47 -05:00

51 lines
1.6 KiB
Bash
Executable File

#!/bin/bash
# Stop GCP emulators
# This script stops Firestore and GCS emulators
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
EMULATOR_LOG_DIR="$PROJECT_ROOT/.emulator-logs"
echo "🛑 Stopping GCP emulators..."
echo ""
# Stop Firestore emulator
if [ -f "$EMULATOR_LOG_DIR/firestore.pid" ]; then
FIRESTORE_PID=$(cat "$EMULATOR_LOG_DIR/firestore.pid")
if ps -p $FIRESTORE_PID > /dev/null 2>&1; then
echo "📦 Stopping Firestore emulator (PID: $FIRESTORE_PID)..."
kill $FIRESTORE_PID 2>/dev/null || true
rm "$EMULATOR_LOG_DIR/firestore.pid"
echo " ✅ Firestore emulator stopped"
else
echo "⚠️ Firestore emulator not running"
rm "$EMULATOR_LOG_DIR/firestore.pid"
fi
else
# Try to kill by port if PID file doesn't exist
FIRESTORE_PID=$(lsof -ti:8080 2>/dev/null || true)
if [ ! -z "$FIRESTORE_PID" ]; then
echo "📦 Stopping Firestore emulator on port 8080 (PID: $FIRESTORE_PID)..."
kill $FIRESTORE_PID 2>/dev/null || true
echo " ✅ Firestore emulator stopped"
else
echo "⚠️ Firestore emulator not running"
fi
fi
# Stop GCS emulator
if docker ps -q -f name=test-gcs-emulator > /dev/null 2>&1; then
echo "📦 Stopping GCS emulator (Docker container)..."
docker stop test-gcs-emulator >/dev/null 2>&1 || true
docker rm test-gcs-emulator >/dev/null 2>&1 || true
echo " ✅ GCS emulator stopped"
else
echo "⚠️ GCS emulator not running"
fi
echo ""
echo "🎉 Emulators stopped successfully!"