Add MonitorAlbum component tests: 21 cases covering all flow diagrams (bufconn + testcontainers + hand-rolled mocks)
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
@startuml MonitorAlbum - Indexer & Parse Failures
|
||||
skinparam sequenceMessageAlign center
|
||||
skinparam responseMessageBelowArrow true
|
||||
title MonitorAlbum Error: Indexer Search & Parse Failures
|
||||
|
||||
actor Client
|
||||
participant "MusicAgregatorService" as Service
|
||||
participant "IndexerService\n(Jackett)" as Indexer
|
||||
participant "MagnetResolver" as Magnet
|
||||
|
||||
== Case 1: Indexer search fails (Jackett down / timeout) ==
|
||||
|
||||
Client -> Service: MonitorAlbum(album_id, quality)
|
||||
note right: metadata fetch + persist succeeded
|
||||
|
||||
Service -> Indexer: Search("Artist Album", tracker)
|
||||
Indexer --> Service: error (connection refused / timeout)
|
||||
Service --> Client: error
|
||||
note right #salmon: Full stop after metadata.\nAlbum is persisted & monitored\nbut no torrent found.
|
||||
|
||||
== Case 2: Indexer returns zero results ==
|
||||
|
||||
Client -> Service: MonitorAlbum(album_id, quality)
|
||||
Service -> Indexer: Search("Artist Album", tracker)
|
||||
Indexer --> Service: SearchResponse (0 items)
|
||||
Service -> Service: parseSearchResults → empty
|
||||
Service -> Service: filterByQuality → empty
|
||||
Service --> Client: MonitorAlbumResponse
|
||||
note right #orange: Partial response.\nalbum + artist returned.\nrelease: nil.\nNo torrent added.
|
||||
|
||||
== Case 3: All results have no seeders ==
|
||||
|
||||
Client -> Service: MonitorAlbum(album_id, quality)
|
||||
Service -> Indexer: Search(...)
|
||||
Indexer --> Service: SearchResponse (5 items, all seeders=0)
|
||||
|
||||
loop for each item
|
||||
Service -> Service: item.Seeders == 0 → skip
|
||||
note right: Logged as warning per item
|
||||
end
|
||||
|
||||
Service -> Service: parsed = empty
|
||||
Service -> Service: filterByQuality → empty
|
||||
Service --> Client: MonitorAlbumResponse (no release)
|
||||
|
||||
== Case 4: All magnet resolves fail ==
|
||||
|
||||
Client -> Service: MonitorAlbum(album_id, quality)
|
||||
Service -> Indexer: Search(...)
|
||||
Indexer --> Service: SearchResponse (3 items)
|
||||
|
||||
loop for each item
|
||||
Service -> Magnet: Resolve(magnet_uri)
|
||||
Magnet --> Service: error (timeout / no active peers)
|
||||
Service -> Service: fallback to title parse
|
||||
note right: Release parsed from title only.\nFormat may be "unknown".\nNo torrent data (nil).
|
||||
end
|
||||
|
||||
Service -> Service: filterByQuality(parsed, LOSSLESS)
|
||||
note right #orange: Title-parsed releases may have\nformat=unknown → not lossless\n→ filtered out
|
||||
Service --> Client: MonitorAlbumResponse (no release)
|
||||
|
||||
== Case 5: No results match quality filter ==
|
||||
|
||||
Client -> Service: MonitorAlbum(album_id, quality=LOSSLESS)
|
||||
Service -> Indexer: Search(...)
|
||||
Indexer --> Service: SearchResponse (3 items)
|
||||
Service -> Service: parseSearchResults → 3 items (all MP3)
|
||||
Service -> Service: filterByQuality(LOSSLESS) → empty
|
||||
note right: All releases are lossy.\nQuality filter rejects all.
|
||||
Service --> Client: MonitorAlbumResponse
|
||||
note right #orange: album + artist returned.\nrelease: nil.\n"no releases match quality filter"
|
||||
|
||||
@enduml
|
||||
Reference in New Issue
Block a user