test(acquisition): integration tests for acquisition pipeline (P103)#102
Merged
forkwright merged 1 commit intomainfrom Mar 16, 2026
Merged
test(acquisition): integration tests for acquisition pipeline (P103)#102forkwright merged 1 commit intomainfrom
forkwright merged 1 commit intomainfrom
Conversation
Contributor
|
Consider splitting into smaller PRs for easier review. Not a blocker, just a signal. |
Add 25 integration tests covering: - Search endpoint with mock DynSearchService (2 tests) - Download queue CRUD: snapshot, enqueue, cancel, reprioritize (6 tests) - Media request workflow with admin auth gates (3 tests) - Wanted list CRUD (2 tests) - Auth enforcement: 401 unauthenticated, 403 member-on-admin (2 tests) - Pipeline: enqueue→dispatch, completion→import (2 tests) - Queue ordering: priority tiers and FIFO within tier (2 tests) - Failure handling: transient retry, permanent failure, budget exhaustion (3 tests) - Startup recovery: DB reload and HTTP visibility (2 tests) - Indexer test_indexer endpoint (1 test) Test infrastructure: - MockSearchService (canned JSON results via DynSearchService) - MockEngine (records dispatched downloads via mpsc channel) - MockImportService (records completed imports via mpsc channel) - In-memory SQLite with full migration stack - JWT auth helpers for admin/member tokens Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
c8080f0 to
f54f039
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Test coverage
Observations
BUG — indexer create status mismatch:
create_indexerinparoche/src/routes/indexer.rsinsertsstatus='unknown'but the004_indexers.sqlmigration hasCHECK(status IN ('active', 'degraded', 'failed')). Any successful create will fail with a constraint violation. Tests work around this by testing auth (403) which fires before the SQL.BUG — retry count not propagated in ActiveEntry:
SyntaxisService::try_dispatch_nextalways createsActiveEntry { retry_count: 0 }regardless of the actual retry count stored in the DB. This meanson_download_failedalways seesretry_count=0, so retry budget exhaustion only triggers whenconfig.retry_count=0. The retry budget test works around this by settingretry_count: 0in config. A fix would readretry_countfrom the DB or carry it onQueueItem.DEBT — download route SQL:
download.rsuses raw SQL string formatting (format!("{SELECT_DOWNLOAD} WHERE ...")) rather than typed queries, making it fragile to schema changes.Validation
Test plan
cargo fmt --all -- --checkpassescargo clippy --workspace --all-targets -- -D warningspassescargo test --workspace— all tests pass🤖 Generated with Claude Code