mirror of
https://github.com/navidrome/navidrome.git
synced 2026-10-21 08:47:16 +02:00
test(nativeapi): cover gaveUpAfter and its omission
GaveUpAfter decodes ItemArtwork.LastFailure, a separate path from LastAttemptFailed's queue-row trace; nothing previously exercised it.
This commit is contained in:
parent
395f2f9ae5
commit
0fcce273a2
1 changed files with 7 additions and 1 deletions
|
|
@ -73,11 +73,12 @@ var _ = Describe("GET /artwork/explain", func() {
|
|||
It("returns the report for an admin", func() {
|
||||
// Storage shape from core/artwork/trace.go's storedStep: single-letter keys, "d" optional.
|
||||
trace := `[{"c":"external:deezer","o":"hit","d":"https://cdn/x.jpg"}]`
|
||||
gaveUpTrace := `[{"c":"external:deezer","o":"error","d":"connection reset"}]`
|
||||
attemptedAt := time.Date(2026, 9, 1, 10, 0, 0, 0, time.UTC)
|
||||
Expect(artRepo.PutItemArtwork(&model.ItemArtwork{
|
||||
ItemKind: model.KindArtistArtwork.Prefix(), ItemID: "ar-1", ImageType: model.ImageTypePrimary,
|
||||
Hash: "abc", Source: "external:deezer", SourcePath: "/music/Radiohead/folder.jpg", Trace: trace,
|
||||
AttemptedAt: attemptedAt,
|
||||
LastFailure: gaveUpTrace, AttemptedAt: attemptedAt,
|
||||
})).To(Succeed())
|
||||
|
||||
req := createAuthenticatedRequest("GET", "/artwork/explain?kind=ar&id=ar-1", nil, adminToken)
|
||||
|
|
@ -101,6 +102,9 @@ var _ = Describe("GET /artwork/explain", func() {
|
|||
Expect(got["steps"]).To(Equal([]any{
|
||||
map[string]any{"candidate": "external:deezer", "outcome": "hit", "detail": "https://cdn/x.jpg"},
|
||||
}))
|
||||
Expect(got["gaveUpAfter"]).To(Equal([]any{
|
||||
map[string]any{"candidate": "external:deezer", "outcome": "error", "detail": "connection reset"},
|
||||
}))
|
||||
})
|
||||
|
||||
It("returns the queue state and the last-attempt trace", func() {
|
||||
|
|
@ -143,6 +147,8 @@ var _ = Describe("GET /artwork/explain", func() {
|
|||
Expect(json.Unmarshal(w.Body.Bytes(), &got)).To(Succeed())
|
||||
Expect(got).ToNot(HaveKey("stored"))
|
||||
Expect(got).ToNot(HaveKey("queued"))
|
||||
Expect(got).ToNot(HaveKey("lastAttemptFailed"))
|
||||
Expect(got).ToNot(HaveKey("gaveUpAfter"))
|
||||
Expect(got["chainOrigin"]).To(Equal("not recorded"))
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue