docs: record auth hash alignment and validation results
This commit is contained in:
1 parent
22887fef03
commit
f7819904b9
51 files changed
+1792
-542
No files matched your search
@@ -8,7 +8,6 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"slices"
|
||||
"strings"
|
||||
"sync"
|
||||
"testing"
|
||||
)
|
||||
@@ -94,16 +93,15 @@ func TestProxyThumbnailPrefersProjectMount(t *testing.T) {
|
||||
if rec.Body.String() != "from mount" {
|
||||
t.Fatalf("body = %q, want the mount copy", rec.Body.String())
|
||||
}
|
||||
for _, request := range node.seen() {
|
||||
if !strings.Contains(request, "/api/mount/") {
|
||||
t.Fatalf("legacy root was consulted although the mount had the thumbnail: %v", node.seen())
|
||||
}
|
||||
want := []string{"GET " + mount}
|
||||
if got := node.seen(); !slices.Equal(got, want) {
|
||||
t.Fatalf("requests = %v, want one direct GET to the mount", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestProxyThumbnailFallsBackToLegacyRoot(t *testing.T) {
|
||||
legacy := "/thumbnails/" + testThumbnailID + ".jpg"
|
||||
client, _ := newThumbnailTestClient(t, map[string]string{legacy: "from legacy"})
|
||||
client, node := newThumbnailTestClient(t, map[string]string{legacy: "from legacy"})
|
||||
|
||||
rec := httptest.NewRecorder()
|
||||
if !client.ProxyThumbnail(rec, thumbnailRequest(), "ContentScanner", testThumbnailID) {
|
||||
@@ -112,10 +110,28 @@ func TestProxyThumbnailFallsBackToLegacyRoot(t *testing.T) {
|
||||
if rec.Body.String() != "from legacy" {
|
||||
t.Fatalf("body = %q, want the legacy copy", rec.Body.String())
|
||||
}
|
||||
want := []string{"GET /api/mount/ContentScanner/thumbnails/" + testThumbnailID + ".jpg", "GET " + legacy}
|
||||
if got := node.seen(); !slices.Equal(got, want) {
|
||||
t.Fatalf("requests = %v, want mount miss followed by legacy GET", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestProxyThumbnailCachesResolvedPath(t *testing.T) {
|
||||
mount := "/api/mount/MediaViewer/thumbnails/" + testThumbnailID + ".jpg"
|
||||
client, node := newThumbnailTestClient(t, map[string]string{mount: "from mount"})
|
||||
for range 2 {
|
||||
if !client.ProxyThumbnail(httptest.NewRecorder(), thumbnailRequest(), "MediaViewer", testThumbnailID) {
|
||||
t.Fatal("ProxyThumbnail missed although the mount holds the thumbnail")
|
||||
}
|
||||
}
|
||||
want := []string{"GET " + mount, "GET " + mount}
|
||||
if got := node.seen(); !slices.Equal(got, want) {
|
||||
t.Fatalf("requests = %v, want one direct GET per request to the cached path", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestProxyThumbnailReportsMissingWithoutWriting(t *testing.T) {
|
||||
client, _ := newThumbnailTestClient(t, nil)
|
||||
client, node := newThumbnailTestClient(t, nil)
|
||||
|
||||
rec := httptest.NewRecorder()
|
||||
if client.ProxyThumbnail(rec, thumbnailRequest(), "ContentScanner", testThumbnailID) {
|
||||
@@ -124,6 +140,13 @@ func TestProxyThumbnailReportsMissingWithoutWriting(t *testing.T) {
|
||||
if rec.Body.Len() != 0 {
|
||||
t.Fatalf("ProxyThumbnail wrote %q on a miss; the caller needs a clean fallback", rec.Body.String())
|
||||
}
|
||||
want := []string{
|
||||
"GET /api/mount/ContentScanner/thumbnails/" + testThumbnailID + ".jpg",
|
||||
"GET /thumbnails/" + testThumbnailID + ".jpg",
|
||||
}
|
||||
if got := node.seen(); !slices.Equal(got, want) {
|
||||
t.Fatalf("requests = %v, want one GET for each candidate path", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestFetchThumbnailToScratchFallsBackToLegacyRoot(t *testing.T) {
|
||||
|
||||
Reference in new issue
Block a user