# Resilience & Performance Tests **Task**: 05_test_resilience_perf **Name**: Resilience & Performance Tests **Description**: Implement resilience tests (dependency failure) and performance latency tests **Complexity**: 3 points **Dependencies**: 01_test_infrastructure, 02_test_health_auth **Component**: Blackbox Tests **Tracker**: pending **Epic**: pending ## Problem No tests verify system behavior when external dependencies fail, or baseline performance characteristics. ## Outcome - API unavailable during login returns error (NFT-RES-01) - CDN unavailable during download returns error (NFT-RES-02) - Docker daemon unavailable during unlock reports error state (NFT-RES-03) - Health endpoint meets latency threshold (NFT-PERF-01) ## Scope ### Included - NFT-RES-01: API unavailable during login - NFT-RES-02: CDN unavailable during resource download - NFT-RES-03: Docker daemon unavailable during unlock - NFT-PERF-01: Health endpoint latency - NFT-PERF-02: Login latency - NFT-PERF-03: Resource download latency ### Excluded - Blackbox functional tests (covered in other tasks) - NFT-SEC-03 (hardware-bound key test — complex mock setup, tracked separately) ## Acceptance Criteria **AC-1: API failure handled gracefully** Given the mock API is stopped When POST /login is called Then HTTP 401 with error detail **AC-2: CDN failure handled gracefully** Given logged in but mock CDN is stopped When POST /load/testmodel is called Then HTTP 500 with error detail **AC-3: Docker failure reported in unlock state** Given Docker socket not mounted When POST /unlock and poll status Then state transitions to "error" with failure description **AC-4: Health latency within threshold** Given the loader is running When 100 sequential GET /health requests are sent Then p95 latency ≤ 100ms ## Blackbox Tests | AC Ref | Initial Data/Conditions | What to Test | Expected Behavior | NFR References | |--------|------------------------|-------------|-------------------|----------------| | AC-1 | Mock API stopped | POST /login | 401, error | NFT-RES-01 | | AC-2 | CDN stopped, no local cache | POST /load | 500, error | NFT-RES-02 | | AC-3 | No Docker socket | POST /unlock + poll | error state | NFT-RES-03 | | AC-4 | Normal operation | 100x GET /health | p95 ≤ 100ms | NFT-PERF-01 |