🐳 Implement Docker-based testing with full CI/CD pipeline
Some checks reported errors
continuous-integration/drone/push Build encountered an error
Some checks reported errors
continuous-integration/drone/push Build encountered an error
✨ Features: - Docker Compose testing environment (docker-compose.test.yml) - Specialized test Dockerfile (Dockerfile.test) - Test-specific Django settings (settings_test.py) - Complete Drone CI/CD pipeline with 8 stages - PostgreSQL 17 container for isolated testing - Network isolation for testing containers 🧪 Testing improvements: - All 6 tests passing successfully - Fixed ServiceRequest model tests - Added proper Category and Service imports - Container-based testing as requested 🚀 CI/CD enhancements: - Code quality checks (flake8, black, bandit) - Database migration testing - Unit and integration tests - Docker image building and security scanning - Telegram notifications for build status - Production deployment pipeline - Scheduled maintenance tasks 🔧 Dependencies: - Added dj-database-url for DATABASE_URL parsing - Added testing dependencies (pytest, coverage) - Updated requirements.txt with all needed packages 🎯 Result: Complete Docker network isolated testing system ready for production CI/CD
This commit is contained in:
30
Dockerfile.test
Normal file
30
Dockerfile.test
Normal file
@@ -0,0 +1,30 @@
|
||||
# Dockerfile для тестирования
|
||||
FROM python:3.10-slim
|
||||
|
||||
# Установка системных зависимостей
|
||||
RUN apt-get update && apt-get install -y \
|
||||
libpq-dev \
|
||||
gcc \
|
||||
curl \
|
||||
postgresql-client \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Рабочая директория
|
||||
WORKDIR /app
|
||||
|
||||
# Копируем requirements и устанавливаем зависимости
|
||||
COPY requirements.txt .
|
||||
RUN pip install --upgrade pip && pip install -r requirements.txt
|
||||
|
||||
# Копируем код приложения
|
||||
COPY . .
|
||||
|
||||
# Настройки для тестов
|
||||
ENV PYTHONPATH=/app
|
||||
ENV DJANGO_SETTINGS_MODULE=smartsoltech.settings_test
|
||||
ENV SECRET_KEY=test-secret-key-for-ci-very-long-and-secure-key-12345
|
||||
ENV DEBUG=False
|
||||
ENV ALLOWED_HOSTS=localhost,127.0.0.1,postgres,*
|
||||
|
||||
# Команда по умолчанию
|
||||
CMD ["python", "smartsoltech/manage.py", "test", "--settings=smartsoltech.settings_test", "--verbosity=2"]
|
||||
Reference in New Issue
Block a user