video-processor/Makefile
Ryan Malloy 1a7d48f171 Add comprehensive end-to-end Docker integration tests
Implements complete integration test suite that validates the entire
video processing system in a containerized environment.

## Core Features
- **Video Processing Pipeline Tests**: Complete E2E validation including
  encoding, thumbnails, sprites, and metadata extraction
- **Procrastinate Worker Integration**: Async job processing, queue
  management, and error handling with version compatibility
- **Database Migration Testing**: Schema creation, version compatibility,
  and production-like migration workflows
- **Docker Orchestration**: Dedicated test environment with PostgreSQL,
  workers, and proper service dependencies

## Test Infrastructure
- **43 integration test cases** covering all major functionality
- **Containerized test environment** isolated from development
- **Automated CI/CD pipeline** with GitHub Actions
- **Performance benchmarking** and resource usage validation
- **Comprehensive error scenarios** and edge case handling

## Developer Tools
- `./scripts/run-integration-tests.sh` - Full-featured test runner
- `Makefile` - Simplified commands for common tasks
- `docker-compose.integration.yml` - Dedicated test environment
- GitHub Actions workflow with test matrix and artifact upload

## Test Coverage
- Multi-format video encoding (MP4, WebM, OGV)
- Quality preset validation (low, medium, high, ultra)
- Async job submission and processing
- Worker version compatibility (Procrastinate 2.x/3.x)
- Database schema migrations and rollbacks
- Concurrent processing scenarios
- Performance benchmarks and timeouts

Files Added:
- tests/integration/ - Complete test suite with fixtures
- docker-compose.integration.yml - Test environment configuration
- scripts/run-integration-tests.sh - Test runner with advanced options
- .github/workflows/integration-tests.yml - CI/CD pipeline
- Makefile - Development workflow automation
- Enhanced pyproject.toml with integration test dependencies

Usage:
```bash
make test-integration                    # Run all integration tests
./scripts/run-integration-tests.sh -v   # Verbose output
./scripts/run-integration-tests.sh -k   # Keep containers for debugging
make docker-test                        # Clean Docker test run
```
2025-09-05 11:24:08 -06:00

165 lines
4.3 KiB
Makefile

# Video Processor Development Makefile
# Simplifies common development and testing tasks
.PHONY: help install test test-unit test-integration test-all lint format type-check clean docker-build docker-test
# Default target
help:
@echo "Video Processor Development Commands"
@echo "====================================="
@echo ""
@echo "Development:"
@echo " install Install dependencies with uv"
@echo " install-dev Install with development dependencies"
@echo ""
@echo "Testing:"
@echo " test Run unit tests only"
@echo " test-unit Run unit tests with coverage"
@echo " test-integration Run Docker integration tests"
@echo " test-all Run all tests (unit + integration)"
@echo ""
@echo "Code Quality:"
@echo " lint Run ruff linting"
@echo " format Format code with ruff"
@echo " type-check Run mypy type checking"
@echo " quality Run all quality checks (lint + format + type-check)"
@echo ""
@echo "Docker:"
@echo " docker-build Build Docker images"
@echo " docker-test Run tests in Docker environment"
@echo " docker-demo Start demo services"
@echo " docker-clean Clean up Docker containers and volumes"
@echo ""
@echo "Utilities:"
@echo " clean Clean up build artifacts and cache"
@echo " docs Generate documentation (if applicable)"
# Development setup
install:
uv sync
install-dev:
uv sync --dev
# Testing targets
test: test-unit
test-unit:
uv run pytest tests/ -x -v --tb=short --cov=src/ --cov-report=html --cov-report=term
test-integration:
./scripts/run-integration-tests.sh
test-integration-verbose:
./scripts/run-integration-tests.sh --verbose
test-integration-fast:
./scripts/run-integration-tests.sh --fast
test-all: test-unit test-integration
# Code quality
lint:
uv run ruff check .
format:
uv run ruff format .
type-check:
uv run mypy src/
quality: format lint type-check
# Docker operations
docker-build:
docker-compose build
docker-test:
docker-compose -f docker-compose.integration.yml build
./scripts/run-integration-tests.sh --clean
docker-demo:
docker-compose up -d postgres
docker-compose run --rm migrate
docker-compose up -d worker
docker-compose up demo
docker-clean:
docker-compose down -v --remove-orphans
docker-compose -f docker-compose.integration.yml down -v --remove-orphans
docker system prune -f
# Cleanup
clean:
rm -rf .pytest_cache/
rm -rf htmlcov/
rm -rf .coverage
rm -rf test-reports/
rm -rf dist/
rm -rf *.egg-info/
find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
find . -type f -name "*.pyc" -delete
# CI/CD simulation
ci-test:
@echo "Running CI-like test suite..."
$(MAKE) quality
$(MAKE) test-unit
$(MAKE) test-integration
# Development workflow helpers
dev-setup: install-dev
@echo "Development environment ready!"
@echo "Run 'make test' to verify installation"
# Quick development cycle
dev: format lint test-unit
# Release preparation
pre-release: clean quality test-all
@echo "Ready for release! All tests passed and code is properly formatted."
# Documentation (placeholder for future docs)
docs:
@echo "Documentation generation not yet implemented"
# Show current test coverage
coverage:
uv run pytest tests/ --cov=src/ --cov-report=html --cov-report=term
@echo "Coverage report generated in htmlcov/"
# Run specific test file
test-file:
@if [ -z "$(FILE)" ]; then \
echo "Usage: make test-file FILE=path/to/test_file.py"; \
else \
uv run pytest $(FILE) -v; \
fi
# Run tests matching a pattern
test-pattern:
@if [ -z "$(PATTERN)" ]; then \
echo "Usage: make test-pattern PATTERN=test_name_pattern"; \
else \
uv run pytest -k "$(PATTERN)" -v; \
fi
# Development server (if web demo exists)
dev-server:
uv run python examples/web_demo.py
# Database operations (requires running postgres)
db-migrate:
uv run python -c "import asyncio; from video_processor.tasks.migration import migrate_database; asyncio.run(migrate_database('postgresql://video_user:video_password@localhost:5432/video_processor'))"
# Show project status
status:
@echo "Project Status:"
@echo "==============="
@uv --version
@echo ""
@echo "Python packages:"
@uv pip list | head -10
@echo ""
@echo "Docker status:"
@docker-compose ps || echo "No containers running"