- Replaced module-level path variables in constants.py with a structured Pydantic Config class. - Updated all relevant modules (train.py, augmentation.py, exports.py, dataset-visualiser.py, manual_run.py) to access paths through the new config structure. - Fixed bugs related to image processing and model saving. - Enhanced test infrastructure to accommodate the new configuration approach. This refactor improves code maintainability and clarity by centralizing configuration management.
2.2 KiB
Annotation Queue Message Tests
Task: AZ-163_test_annotation_queue Name: Annotation Queue Message Tests Description: Implement 5 tests for annotation queue message parsing — Created, Validated bulk, Deleted bulk, malformed handling Complexity: 2 points Dependencies: AZ-152_test_infrastructure Component: Blackbox Tests Jira: AZ-163 Epic: AZ-151
Problem
The annotation queue processes msgpack-encoded messages from RabbitMQ Streams. Tests must verify correct parsing of all message types and graceful handling of malformed input.
Outcome
- 5 passing pytest tests in
tests/test_annotation_queue.py
Scope
Included
- BT-AQM-01: Parse Created annotation message (all fields populated correctly)
- BT-AQM-02: Parse Validated bulk message (status == Validated, names list matches)
- BT-AQM-03: Parse Deleted bulk message (status == Deleted, names list matches)
- BT-AQM-04: Malformed message raises exception
- RT-AQM-01: Malformed msgpack bytes handled (exception caught, no crash)
Excluded
- Live RabbitMQ Streams connection (requires external service)
- Queue offset persistence (requires live broker)
Acceptance Criteria
AC-1: Created message Given msgpack bytes matching AnnotationMessage schema (status=Created, role=Validator) When decoded and constructed Then all fields populated: name, detections, image bytes, status == "Created", role == "Validator"
AC-2: Validated bulk Given msgpack bytes with status=Validated, list of names When decoded and constructed Then status == "Validated", names list matches input
AC-3: Deleted bulk Given msgpack bytes with status=Deleted, list of names When decoded and constructed Then status == "Deleted", names list matches input
AC-4: Malformed msgpack Given invalid msgpack bytes When decode is attempted Then exception raised
AC-5: Resilient handling Given random bytes (not valid msgpack) When passed to message handler Then exception caught, handler doesn't crash
Constraints
- Msgpack messages constructed in-memory at test time
- Must match the AnnotationMessage/AnnotationBulkMessage schemas from annotation-queue/
- Resilience test marked:
@pytest.mark.resilience