EU-Utility/plugins/integration_tests/service_fallback/README.md

1.4 KiB

Service Fallback & Graceful Degradation Tests

Tests EU-Utility's ability to handle service unavailability gracefully.

Test Categories

Network Failures

  • DNS resolution failures
  • Connection refused
  • Network unreachable
  • Service timeouts

Missing Dependencies

  • OCR engines not installed
  • requests library missing
  • paho-mqtt not available
  • Optional libraries

API Errors

  • Rate limiting (429)
  • Authentication failures (401/403)
  • Server errors (500/503)
  • Invalid responses

Timeout Handling

  • Request timeouts
  • Slow responses
  • Hanging connections
  • Retry logic

Expected Graceful Degradation

When Network Fails

  • Show cached data if available
  • Display clear error message
  • Retry with exponential backoff
  • Never block UI indefinitely

When Dependencies Missing

  • Disable affected features
  • Show informative messages
  • Provide alternatives
  • Continue with reduced functionality

When API Errors

  • Handle specific error codes
  • Implement appropriate retry logic
  • Show user-friendly messages
  • Log for debugging

Recovery Mechanisms

  1. Automatic Retry: Exponential backoff for transient failures
  2. Cached Data: Use stale cache when fresh data unavailable
  3. Feature Degradation: Disable features that depend on unavailable services
  4. User Notification: Clear messages about service status
  5. Reconnection: Detect when service returns and resume normal operation