Vision QA & Testing Strategy
This section outlines the testing strategy, workflows, and technologies used in the firstbreath-vision repository, which contains the AI and computer vision microservices.
π Technology Stackβ
- Language: Python 3.11
- Frameworks: PyTorch, OpenCV, Ultralytics YOLO
- Architecture: Microservices
camera-manager: Handling RTSP streams and camera logic.batch-inference: Running AI models on video frames.redis-worker: Asynchronous task processing.
- Testing Framework: pytest
- Linting & Formatting: Black, Flake8, Safety
π§ͺ Testing Strategyβ
We use pytest for unit and integration testing across all services.
Test Structureβ
Each service has its own tests/ directory:
services/camera-manager/tests/services/batch-inference/tests/services/redis-worker/tests/
Running Tests Locallyβ
To run tests for a specific service:
cd services/camera-manager
python -m pytest tests/
π CI/CD Workflowsβ
1. CI Pipeline (ci.yml)β
Triggers on push and pull_request to main and dev.
Stages:
-
Quality Gates:
- Formatting: Checks code style with
black. - Linting: Runs
flake8to catch syntax errors and undefined names. - Security: Runs
safety checkonrequirements.txtfiles to identify vulnerable dependencies.
- Formatting: Checks code style with
-
Testing:
- Installs dependencies (using CPU-only versions of PyTorch for speed).
- Runs
pytestwith coverage (--cov) for each service (camera-manager,batch-inference,redis-worker).
-
SonarQube Analysis (integrated in CI):
- Scans code and reports coverage and quality metrics to SonarQube.
- Enforces Quality Gate checks.
2. Docker Build (docker-build-and-push.yml)β
- Builds Docker images for the services.
- Pushes images to the container registry (if configured).
βΏ Accessibilityβ
Not applicable for these backend/AI services.