Goal
Comprehensive testing of database component template generation.
Implementation
- Add database-specific template tests
- Test both with and without database component
- Validate generated projects pass all quality checks
- Test database functionality in generated projects
Files Modified
tests/cli/test_cli_init.py — Add test cases for database component
Makefile — Add targets for database component testing
Testing Coverage
- Database component selection and validation
- Generated project structure with database
- Database configuration and connection
- Health check integration
- Import validation
Success Criteria
- All template tests pass with database component
- Generated projects with database component pass
make check
- Database health checks work in generated projects
- No broken imports or missing dependencies
Component Specification
"database": ComponentSpec(
name="database",
type=ComponentType.INFRASTRUCTURE,
description="SQLite database with SQLModel ORM",
requires=[], # Standalone component
recommends=[],
conflicts=[],
docker_services=[], # No Docker services needed for SQLite
pyproject_deps=["sqlmodel>=0.0.14", "sqlalchemy>=2.0.0", "aiosqlite>=0.19.0"],
template_files=["app/core/db.py"],
)
Testing Strategy
Per Ticket:
- Unit Tests: Test individual functions and components
- CLI Tests: Test command-line integration
- Template Tests: Test generated project structure and functionality
- Integration Tests: Test database connectivity and health checks
- Quality Checks: Ensure all generated code passes linting and type checking
Overall Validation:
make test passes for Aegis Stack CLI
make test-template with database component passes
- Generated projects with database component pass all quality checks
- Database functionality works correctly in generated projects
Success Metrics
- CLI Integration:
aegis init test-db --components db creates working project
- Database Functionality: Generated
app/core/db.py provides working session management
- Health Monitoring: Database health checks integrate with existing system
- Code Quality: All generated code passes linting, type checking, and tests
- Documentation: Component documentation updated with database information
Risk Mitigation
- SQLite File Location: Use relative path
data/app.db that works in containers
- Foreign Key Support: Ensure foreign key pragma set correctly for SQLite
- Session Management: Proper exception handling and transaction rollback
- Testing Isolation: Each ticket fully tested before proceeding to next
Future Considerations
- PostgreSQL Support: Add as separate component or engine configuration option
- Alembic Migrations: Add database migration support
- Model Organization: Move from
app/core/db.py to app/models/ structure
- Backend Integration: Add database dependency injection to FastAPI routes
- Scheduler Integration: Add database session access to scheduled tasks
Goal
Comprehensive testing of database component template generation.
Implementation
Files Modified
tests/cli/test_cli_init.py— Add test cases for database componentMakefile— Add targets for database component testingTesting Coverage
Success Criteria
make checkComponent Specification
Testing Strategy
Per Ticket:
Overall Validation:
make testpasses for Aegis Stack CLImake test-templatewith database component passesSuccess Metrics
aegis init test-db --components dbcreates working projectapp/core/db.pyprovides working session managementRisk Mitigation
data/app.dbthat works in containersFuture Considerations
app/core/db.pytoapp/models/structure