Skip to content

test(client): add API error scenario and rate limiting tests #57

@joelp172

Description

@joelp172

Summary

The test suite lacks coverage for API failure scenarios — rate limiting, timeouts, transient errors, and connection failures are not tested.

Current Behaviour

  • Mock server only returns success responses
  • No tests for 429, 500, 502, 503, timeout, or connection refused scenarios
  • No tests for retry behaviour or backoff logic
  • No tests for concurrent API calls

Proposed Test Cases

  • 429 Rate Limit response triggers retry with backoff
  • 500 Internal Server Error triggers retry
  • 502/503 Gateway Error triggers retry
  • 400 Bad Request is not retried
  • 401 Unauthorized is not retried
  • Connection timeout triggers retry
  • Connection refused triggers retry
  • Max retry limit is respected
  • Retry-After header is parsed and respected
  • Concurrent API calls don't interfere with each other
  • Mock server can simulate intermittent failures

Acceptance Criteria

  • Mock server supports configurable error injection
  • All retryable error types tested
  • Non-retryable errors verified to not retry
  • Backoff timing validated (exponential increase)
  • Tests pass reliably in CI

Phase

P2 — Testing Gaps (Phase 2: Trust)

Dependencies

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: mediumP2/P3 - Should havetestingTest coverage and CI improvements

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions