38 lines
1.1 KiB
Bash
Executable File
38 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
echo "🧪 Testing User Service"
|
|
echo "Working directory: $(pwd)"
|
|
|
|
# Activate virtual environment
|
|
source .venv/bin/activate
|
|
|
|
# Set PYTHONPATH to include the project root
|
|
export PYTHONPATH="${PWD}:${PYTHONPATH}"
|
|
|
|
# Print configuration
|
|
echo "🔍 Testing configuration loading..."
|
|
python -c "from shared.config import settings; print(f'DATABASE_URL: {settings.DATABASE_URL}')"
|
|
|
|
# Test database connection
|
|
echo "🔍 Testing database connection..."
|
|
python -c "
|
|
import asyncio
|
|
import asyncpg
|
|
from shared.config import settings
|
|
|
|
async def test_db():
|
|
try:
|
|
conn = await asyncpg.connect(settings.DATABASE_URL.replace('postgresql+asyncpg://', 'postgresql://'))
|
|
version = await conn.fetchval('SELECT version()')
|
|
print(f'✅ Database connection successful: {version[:50]}...')
|
|
await conn.close()
|
|
except Exception as e:
|
|
print(f'❌ Database connection failed: {e}')
|
|
|
|
asyncio.run(test_db())
|
|
"
|
|
|
|
# Start user service
|
|
echo "🚀 Starting User Service..."
|
|
cd services/user_service
|
|
exec python -m uvicorn main:app --host 0.0.0.0 --port 8001 |