mirror of
https://github.com/azaion/loader.git
synced 2026-04-22 11:26:33 +00:00
Add E2E tests, fix bugs
Made-with: Cursor
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
# Test Environment
|
||||
|
||||
## Overview
|
||||
|
||||
**System under test**: Azaion.Loader FastAPI service at `http://localhost:8080`
|
||||
**Consumer app purpose**: Python pytest suite exercising the loader through its HTTP API, validating black-box use cases without access to Cython internals.
|
||||
|
||||
## Test Execution
|
||||
|
||||
**Decision**: Local execution
|
||||
**Hardware dependencies found**:
|
||||
- `hardware_service.pyx`: uses `subprocess` with `lscpu`, `lspci`, `/sys/block/sda` (Linux) or PowerShell (Windows) — requires real OS hardware info
|
||||
- `binary_split.py`: calls `docker load` and `docker image inspect` — requires Docker daemon
|
||||
- Cython extensions: must be compiled natively for the target platform
|
||||
|
||||
**Execution instructions (local)**:
|
||||
1. Prerequisites: Python 3.11, GCC, Docker daemon running
|
||||
2. Install deps: `pip install -r requirements.txt && python setup.py build_ext --inplace`
|
||||
3. Start system: `uvicorn main:app --host 0.0.0.0 --port 8080`
|
||||
4. Run tests: `pytest tests/ -v --tb=short`
|
||||
5. Environment variables: `RESOURCE_API_URL`, `IMAGES_PATH`, `API_VERSION`
|
||||
|
||||
## Docker Environment
|
||||
|
||||
### Services
|
||||
|
||||
| Service | Image / Build | Purpose | Ports |
|
||||
|---------|--------------|---------|-------|
|
||||
| system-under-test | Build from `Dockerfile` | Azaion.Loader | 8080 |
|
||||
| mock-api | Python (httpbin or custom) | Mock Azaion Resource API | 9090 |
|
||||
| mock-cdn | MinIO (S3-compatible) | Mock S3 CDN | 9000 |
|
||||
| e2e-consumer | `python:3.11-slim` + pytest | Black-box test runner | — |
|
||||
|
||||
### Networks
|
||||
|
||||
| Network | Services | Purpose |
|
||||
|---------|----------|---------|
|
||||
| e2e-net | all | Isolated test network |
|
||||
|
||||
### Volumes
|
||||
|
||||
| Volume | Mounted to | Purpose |
|
||||
|--------|-----------|---------|
|
||||
| test-data | e2e-consumer:/data | Test input files |
|
||||
| docker-sock | system-under-test:/var/run/docker.sock | Docker daemon access |
|
||||
|
||||
## Consumer Application
|
||||
|
||||
**Tech stack**: Python 3.11, pytest, requests
|
||||
**Entry point**: `pytest tests/ -v`
|
||||
|
||||
### Communication with system under test
|
||||
|
||||
| Interface | Protocol | Endpoint | Authentication |
|
||||
|-----------|----------|----------|----------------|
|
||||
| Loader API | HTTP | `http://system-under-test:8080` | POST /login first |
|
||||
|
||||
### What the consumer does NOT have access to
|
||||
|
||||
- No direct access to Cython `.so` modules
|
||||
- No shared filesystem with the main system (except Docker socket for verification)
|
||||
- No direct access to mock-api or mock-cdn internals
|
||||
|
||||
## CI/CD Integration
|
||||
|
||||
**When to run**: On push to dev/stage/main (extend `.woodpecker/build-arm.yml`)
|
||||
**Pipeline stage**: After build, before push
|
||||
**Gate behavior**: Block push on failure
|
||||
**Timeout**: 300 seconds (5 minutes)
|
||||
|
||||
## Reporting
|
||||
|
||||
**Format**: CSV
|
||||
**Columns**: Test ID, Test Name, Execution Time (ms), Result (PASS/FAIL/SKIP), Error Message
|
||||
**Output path**: `./test-results/report.csv`
|
||||
Reference in New Issue
Block a user