3.0 KiB
3.0 KiB
Backend System Test Prompt
Project Context
You are working on the mtgonline backend project located at /home/wall-o/projects/mtgonline/backend/.
The backend is a FastAPI application with:
- PostgreSQL database (MTG Online + MTG data)
- Redis caching
- JWT authentication
- MTG card search and statistics endpoints
Current State
Read the state.json file at /home/wall-o/projects/mtgonline/backend/state.json to understand:
- What has been completed
- What the current focus is
- Any blockers or pending tasks
Task: Full Backend System Test
Your goal is to perform a comprehensive system test of the backend to verify all components work correctly together.
Steps to Follow:
-
Read State File
- Read
/home/wall-o/projects/mtgonline/backend/state.json - Understand current progress and what's been tested
- Read
-
Check Docker Containers
- Run:
cd /home/wall-o/projects/mtgonline && docker compose ps - If containers aren't running, start them:
docker compose up -d - Wait for services to be healthy (~40 seconds)
- Run:
-
Run System Test
- Execute:
cd /home/wall-o/projects/mtgonline/backend && python test_system.py - This tests:
- Database connections (PostgreSQL + Redis)
- Cache operations
- Database tables
- API endpoints (health, card search, statistics, auth)
- Execute:
-
Analyze Results
- If tests fail, investigate and fix issues
- Common issues:
- Database not running
- Redis connection failed
- API routes not registered
- Environment variables not set
-
Update State
- Update
state.jsonwith test results - Note any bugs found and fixed
- Document what's working and what needs attention
- Update
-
Report Findings
- Summarize test results (pass/fail rates)
- List any issues found
- Recommend next steps
Expected Test Coverage
The system test (test_system.py) should verify:
- ✅ MTG Online PostgreSQL connection
- ✅ MTG PostgreSQL connection
- ✅ Redis connection and operations
- ✅ MTG Online database tables (users, decks)
- ✅ MTG database tables (sets, cards)
- ✅ MTG card search functionality
- ✅ Health endpoint
- ✅ Card search API endpoint
- ✅ Statistics API endpoint
- ✅ Authentication endpoint
Success Criteria
All tests should pass (100% success rate) before considering the backend ready for frontend development.
Commands Reference
# Check Docker status
cd /home/wall-o/projects/mtgonline && docker compose ps
# Start containers
cd /home/wall-o/projects/mtgonline && docker compose up -d
# Wait for health (40 seconds)
sleep 40
# Run system test
cd /home/wall-o/projects/mtgonline/backend && python test_system.py
# Check logs if issues
cd /home/wall-o/projects/mtgonline && docker compose logs backend
Important Notes
- All code execution must be as user
wall-o(not root) - Use sudo -u wall-o when running commands
- Pin versions in requirements.txt
- Follow PEP 8 for Python code
- Log errors with context
- One change per commit, descriptive messages