# Augmentation Performance, Resilience & Resource Tests

**Task**: AZ-154_test_augmentation_nonfunc
**Name**: Augmentation Non-Functional Tests
**Description**: Implement performance, resilience, and resource limit tests for augmentation — throughput, parallel speedup, error handling, output bounds
**Complexity**: 2 points
**Dependencies**: AZ-152_test_infrastructure
**Component**: Blackbox Tests
**Jira**: AZ-154
**Epic**: AZ-151

## Problem

Augmentation must perform within time thresholds, handle corrupted/missing inputs gracefully, and respect output count bounds.

## Outcome

- 6 passing pytest tests across performance and resilience categories
- Performance tests in `tests/performance/test_augmentation_perf.py`
- Resilience and resource limit tests in `tests/test_augmentation.py` with markers

## Scope

### Included
- PT-AUG-01: Augmentation throughput (10 images ≤ 60s)
- PT-AUG-02: Parallel augmentation speedup (≥ 1.5× faster)
- RT-AUG-01: Handles corrupted image gracefully
- RT-AUG-02: Handles missing label file
- RT-AUG-03: Transform failure produces fewer variants (no crash)
- RL-AUG-01: Output count bounded to exactly 8

### Excluded
- Blackbox functional tests (separate task 02)

## Acceptance Criteria

**AC-1: Throughput**
Given 10 images from fixture dataset
When augment_annotations() runs
Then completes within 60 seconds

**AC-2: Parallel speedup**
Given 10 images from fixture dataset
When run with ThreadPoolExecutor vs sequential
Then parallel is ≥ 1.5× faster

**AC-3: Corrupted image**
Given 1 valid + 1 corrupted image (truncated JPEG)
When augment_annotations() runs
Then valid image produces 8 outputs, corrupted skipped, no crash

**AC-4: Missing label**
Given 1 image with no matching label file
When augment_annotation() runs on it
Then exception caught per-thread, pipeline continues

**AC-5: Transform failure**
Given 1 image + label with extremely narrow bbox
When augment_inner() runs
Then 1-8 ImageLabel objects returned, no crash

**AC-6: Output count bounded**
Given 1 image
When augment_inner() runs
Then exactly 8 outputs returned (never more)

## Constraints

- Performance tests require pytest markers: `@pytest.mark.performance`
- Resilience tests marked: `@pytest.mark.resilience`
- Resource limit tests marked: `@pytest.mark.resource_limit`
- Performance thresholds are generous (CPU-bound, no GPU requirement)
