Files
motovaultpro/docs/redesign/PHASE-11-TESTING.md
Eric Gullickson 046c66fc7d Redesign
2025-11-01 21:27:42 -05:00

270 lines
5.3 KiB
Markdown

# Phase 11: Testing and Validation
## Agent Assignment
**Primary Agent:** test-agent
**Duration:** 20-30 minutes
## Prerequisites
- ALL phases 1-10 must be complete
- All agents must report success
## Objectives
1. Verify all 6 containers are healthy
2. Run full test suite (backend + frontend)
3. Validate all features work end-to-end
4. Confirm no regressions
5. Final architecture validation
## Step-by-Step Instructions
### Step 1: Verify Container Health
```bash
# Check all containers running
docker compose ps
# Expected: 6 services, all "running (healthy)"
# Verify services:
# - mvp-traefik
# - mvp-frontend
# - mvp-backend
# - mvp-postgres
# - mvp-redis
# - mvp-platform
```
### Step 2: Run Backend Tests
```bash
# Enter backend container
docker compose exec mvp-backend npm test
# Expected: All tests pass
# No failures related to tenants, MinIO, or old service names
```
### Step 3: Run Frontend Tests
```bash
# Run frontend tests
make test-frontend
# Expected: All tests pass
```
### Step 4: Test Core Features
**Authentication:**
```bash
# Test Auth0 login
curl -s -k https://admin.motovaultpro.com/api/health
# Expected: 200 OK
```
**Vehicles:**
```bash
# Test vehicle creation
curl -X POST https://admin.motovaultpro.com/api/vehicles \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"vin": "1HGBH41JXMN109186", "nickname": "Test"}'
# Expected: 201 Created
```
**Documents:**
```bash
# Test document upload
curl -X POST https://admin.motovaultpro.com/api/documents \
-H "Authorization: Bearer $TOKEN" \
-F "file=@test.pdf" \
-F "vehicleId=123"
# Expected: 201 Created
# Verify file in filesystem
docker compose exec mvp-backend ls /app/data/documents/
# Expected: Files exist
```
**Platform Service:**
```bash
# Test vehicle makes endpoint
curl http://localhost:8000/vehicles/makes?year=2024
# Expected: JSON array of makes
```
### Step 5: Architecture Validation
**Container Count:**
```bash
docker compose ps --services | wc -l
# Expected: 6
```
**Network Count:**
```bash
docker network ls | grep motovaultpro | wc -l
# Expected: 3 (frontend, backend, database)
```
**Volume Count:**
```bash
docker volume ls | grep mvp | wc -l
# Expected: 2 (mvp_postgres_data, mvp_redis_data)
```
### Step 6: Code Quality Checks
**No Tenant References:**
```bash
grep -r "tenant_id" backend/src/features/ | wc -l
# Expected: 0
```
**No Old Container Names:**
```bash
grep -r "admin-backend\|admin-frontend\|admin-postgres" \
backend/ frontend/ docs/ | wc -l
# Expected: 0
```
**No MinIO References:**
```bash
grep -r "minio\|MinIO" backend/src/ | wc -l
# Expected: 0
```
### Step 7: Performance Check
**Startup Time:**
```bash
time docker compose up -d
# Should be faster than before (fewer containers)
```
**Memory Usage:**
```bash
docker stats --no-stream
# Total memory should be lower than 14-container setup
```
### Step 8: Mobile Testing
```bash
# Test responsive design
# Access https://admin.motovaultpro.com on mobile
# Verify all features work
```
### Step 9: Final Clean Rebuild
```bash
# Ultimate test: clean rebuild
make clean
make setup
# Expected:
# - All 6 containers start
# - Migrations run successfully
# - Application accessible
# - Tests pass
```
## Validation Criteria
### Critical Validations (Must Pass)
- [ ] Exactly 6 containers running
- [ ] All containers healthy
- [ ] Backend tests pass (100%)
- [ ] Frontend tests pass (100%)
- [ ] No tenant_id in application code
- [ ] No old container names in code/docs
- [ ] No MinIO references
- [ ] All features functional
### Integration Validations
- [ ] Auth0 login works
- [ ] Vehicle CRUD works
- [ ] Document upload/download works
- [ ] Fuel logs work
- [ ] Maintenance logs work
- [ ] Stations work
### Architecture Validations
- [ ] 3 networks configured
- [ ] 2 volumes (postgres, redis)
- [ ] Traefik routing works
- [ ] Platform service accessible
## Validation Report
Create validation report:
```bash
cat > docs/redesign/VALIDATION-REPORT-$(date +%Y%m%d).md <<EOF
# Simplification Validation Report
Date: $(date)
## Container Status
$(docker compose ps)
## Test Results
Backend: PASS/FAIL
Frontend: PASS/FAIL
## Architecture Metrics
Containers: 6
Networks: 3
Volumes: 2
## Feature Testing
- Authentication: PASS/FAIL
- Vehicles: PASS/FAIL
- Documents: PASS/FAIL
- Fuel Logs: PASS/FAIL
- Maintenance: PASS/FAIL
- Stations: PASS/FAIL
## Code Quality
Tenant references: 0
Old container names: 0
MinIO references: 0
## Conclusion
Simplification: SUCCESS/FAILURE
Ready for production: YES/NO
EOF
```
## Final Update to EXECUTION-STATE.json
```json
{
"status": "completed",
"completed_at": "[timestamp]",
"phases": {
"11": {
"status": "completed",
"validation_passed": true,
"duration_minutes": 25
}
},
"validations": {
"docker_compose_valid": true,
"backend_builds": true,
"frontend_builds": true,
"tests_pass": true,
"containers_healthy": true,
"no_tenant_references": true,
"no_minio_references": true,
"no_old_container_names": true
}
}
```
## Success Criteria
If all validations pass:
- Architecture successfully simplified
- 14 → 6 containers (57% reduction)
- All features functional
- No regressions
- Ready for production deployment
## If Failures Occur
1. Review VALIDATION-REPORT
2. Identify failing phase
3. Consult ROLLBACK-STRATEGY.md
4. Decide: fix and retry OR rollback