Files
detections/_docs/02_document/integration_tests/test_data.md
T

3.8 KiB
Raw Blame History

E2E Test Data Management

Seed Data Sets

Data Set Description Used by Tests How Loaded Cleanup
onnx-model Small YOLO ONNX model (valid architecture, 1280×1280 input, 19 classes) All detection tests Volume mount to mock-loader /models/azaion.onnx Container restart
classes-json classes.json with 19 detection classes, 3 weather modes, MaxSizeM values All tests Volume mount to detections /app/classes.json Container restart
small-image JPEG image 640×480 — below 1.5× model size (1920×1920 threshold) FT-P-03, FT-P-05, FT-P-06, FT-P-07, FT-N-01, FT-N-02, NFT-PERF-01 Volume mount to consumer /media/ N/A (read-only)
large-image JPEG image 4000×3000 — above 1.5× model size, triggers tiling FT-P-04, FT-P-16, NFT-PERF-03 Volume mount to consumer /media/ N/A (read-only)
test-video MP4 video, 10s duration, 30fps — contains objects across frames FT-P-10, FT-P-11, FT-P-12, NFT-PERF-04 Volume mount to consumer /media/ N/A (read-only)
empty-image Zero-byte file FT-N-01 Volume mount to consumer /media/ N/A (read-only)
corrupt-image Binary garbage (not valid image format) FT-N-02 Volume mount to consumer /media/ N/A (read-only)
jwt-token Valid JWT with exp claim (not signature-verified by detections) FT-P-08, FT-P-09 Generated by consumer at runtime N/A

Data Isolation Strategy

Each test run starts with fresh containers (docker compose down -v && docker compose up). The detections service is stateless — no persistent data between runs. Mock services reset their state on container restart. Tests that modify mock behavior (e.g., making loader unreachable) must run in isolated test groups.

Input Data Mapping

Input Data File Source Location Description Covers Scenarios
data_parameters.md _docs/00_problem/input_data/data_parameters.md API parameter schemas, config defaults, classes.json structure Informs all test input construction

External Dependency Mocks

External Service Mock/Stub How Provided Behavior
Loader Service HTTP stub Docker service mock-loader Serves ONNX model from volume on GET /models/azaion.onnx. Accepts TensorRT upload on POST /upload. Returns 404 for unknown files. Configurable: can simulate downtime (503) via control endpoint POST /mock/config.
Annotations Service HTTP stub Docker service mock-annotations Accepts annotation POST on POST /annotations — stores in memory for verification. Provides token refresh on POST /auth/refresh. Configurable: can simulate downtime (503) via control endpoint POST /mock/config. Returns recorded annotations on GET /mock/annotations for test assertions.

Data Validation Rules

Data Type Validation Invalid Examples Expected System Behavior
Image file (POST /detect) Non-empty bytes, decodable by OpenCV Zero-byte file, random binary, text file 400 Bad Request
media_id (POST /detect/{media_id}) String, unique among active detections Already-active media_id 409 Conflict
AIConfigDto fields probability_threshold: 0.01.0; frame_period_recognition: positive int; big_image_tile_overlap_percent: 0100 probability_threshold: -1 or 2.0; frame_period_recognition: 0 System uses defaults or returns validation error
Authorization header Bearer token format Missing header, malformed JWT Token forwarded to Annotations as-is; detections still proceeds
classes.json JSON array of objects with Id, Name, Color, MaxSizeM Missing file, empty array, malformed JSON Service fails to start / returns empty detections