Skip to content

Add edge-case tests for failures, timeouts, and concurrent access#11

Merged
vladiant merged 2 commits into
mainfrom
extend_test_coverage
Apr 1, 2026
Merged

Add edge-case tests for failures, timeouts, and concurrent access#11
vladiant merged 2 commits into
mainfrom
extend_test_coverage

Conversation

@vladiant
Copy link
Copy Markdown
Collaborator

@vladiant vladiant commented Apr 1, 2026

Summary

Extends test coverage with 67 new edge-case tests targeting failure paths, timeout behavior, and concurrent access patterns across all architecture layers.

Changes

File Tests Focus
test_edge_cases.py 22 Use case failure/timeout/concurrency
test_edge_cases.py 27 Storage, processor, cache thread-safety
test_api_edge_cases.py 18 API error responses, validation boundaries

What's tested

Failure paths

  • Cascading failures in ProcessImageUseCase (thumbnail cleanup OSError, processor ValueError, save failures at each stage)
  • Partial storage cleanup failures in retention sweeps (error counting)
  • Storage/repository errors propagating correctly in upload and get flows
  • Cache behavior when inner repository raises (stale entries, invalidation ordering)

Timeouts

  • asyncio.timeout wrapping slow processing, storage, and retention operations

Concurrent access

  • Pipeline with mixed success/failure/not-found results, all-failure batches, empty batches, serialized execution
  • Thread-safe cache operations under contention (set/get, set/invalidate, eviction pressure, concurrent clear)
  • Concurrent file storage with same filename producing unique paths
  • Concurrent deletes of the same file (exactly-once semantics)
  • Concurrent get_by_id cache misses (thundering herd)

API validation boundaries

  • Empty/corrupt/non-image uploads, BMP content type rejection
  • Exactly-at-limit tag count (20), invalid UUID format
  • Negative offset, zero/over-max limit, empty list results
  • Internal 500 errors from use case exceptions
  • Retention sweep error reporting and DB deadlock propagation

Version bump

PATCH: 2.0.02.0.1 (tests only, no API or behavior changes)

Checklist

  • ruff check — all clean
  • ruff format — all formatted
  • mypy — success, no issues
  • pytest — 168/168 passing (67 new + 101 existing)
  • CHANGELOG.md updated
  • Version bumped in pyproject.toml

@vladiant vladiant merged commit 06ace53 into main Apr 1, 2026
4 checks passed
@vladiant vladiant deleted the extend_test_coverage branch April 1, 2026 06:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant