library, server: a fixture and a comment the leak gate refuses (#8358)
A hidden-folder fixture named an acquisition tool, and a comment cited a milestone id. Both are reworded so the export passes ci/leakgate.sh. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -33,7 +33,7 @@ func libraryTree(t *testing.T, files ...string) string {
|
|||||||
func TestEnumerate_LeavesHiddenFilesAndFoldersOut(t *testing.T) {
|
func TestEnumerate_LeavesHiddenFilesAndFoldersOut(t *testing.T) {
|
||||||
root := libraryTree(t,
|
root := libraryTree(t,
|
||||||
"Artist/Album (2001)/01 Song.flac",
|
"Artist/Album (2001)/01 Song.flac",
|
||||||
".sluice-held/Artist/Album (2001)/01 Song.flac",
|
".set-aside/Artist/Album (2001)/01 Song.flac",
|
||||||
"Artist/.cache/02 Other.mp3",
|
"Artist/.cache/02 Other.mp3",
|
||||||
"Artist/Album (2001)/._01 Song.flac",
|
"Artist/Album (2001)/._01 Song.flac",
|
||||||
)
|
)
|
||||||
@@ -53,8 +53,8 @@ func TestHiddenInLibrary(t *testing.T) {
|
|||||||
want bool
|
want bool
|
||||||
}{
|
}{
|
||||||
{"Artist/Album/01.flac", false},
|
{"Artist/Album/01.flac", false},
|
||||||
{".sluice-held/Artist/Album/01.flac", true},
|
{".set-aside/Artist/Album/01.flac", true},
|
||||||
{".sluice-held", true},
|
{".set-aside", true},
|
||||||
{"Artist/._01.flac", true},
|
{"Artist/._01.flac", true},
|
||||||
{"Artist/Album..Live/01.flac", false},
|
{"Artist/Album..Live/01.flac", false},
|
||||||
{"", false},
|
{"", false},
|
||||||
@@ -73,13 +73,13 @@ func TestHiddenInLibrary(t *testing.T) {
|
|||||||
// The watcher ignores a hidden folder appearing in the library, so nothing
|
// The watcher ignores a hidden folder appearing in the library, so nothing
|
||||||
// set aside in it is watched or queued for a scan.
|
// set aside in it is watched or queued for a scan.
|
||||||
func TestWatcher_IgnoresAHiddenFolderAppearing(t *testing.T) {
|
func TestWatcher_IgnoresAHiddenFolderAppearing(t *testing.T) {
|
||||||
root := libraryTree(t, ".sluice-held/Artist/Album/01 Song.flac")
|
root := libraryTree(t, ".set-aside/Artist/Album/01 Song.flac")
|
||||||
w := &Watcher{
|
w := &Watcher{
|
||||||
scanner: &Scanner{paths: []string{root}},
|
scanner: &Scanner{paths: []string{root}},
|
||||||
logger: slog.New(slog.NewTextHandler(io.Discard, nil)),
|
logger: slog.New(slog.NewTextHandler(io.Discard, nil)),
|
||||||
}
|
}
|
||||||
pending := map[string]struct{}{}
|
pending := map[string]struct{}{}
|
||||||
held := filepath.Join(root, ".sluice-held")
|
held := filepath.Join(root, ".set-aside")
|
||||||
if w.handleEvent(nil, fsnotify.Event{Name: held, Op: fsnotify.Create}, pending) || len(pending) != 0 {
|
if w.handleEvent(nil, fsnotify.Event{Name: held, Op: fsnotify.Create}, pending) || len(pending) != 0 {
|
||||||
t.Fatalf("a hidden folder appearing queued %v", pending)
|
t.Fatalf("a hidden folder appearing queued %v", pending)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,8 +39,8 @@ import (
|
|||||||
|
|
||||||
// ScanTrigger is the subset of the scanner the HTTP handler needs. Kept as an
|
// ScanTrigger is the subset of the scanner the HTTP handler needs. Kept as an
|
||||||
// interface so tests can stub it without touching the DB. The progressCb
|
// interface so tests can stub it without touching the DB. The progressCb
|
||||||
// parameter (added in m7-scan-progress) lets the orchestrator drive partial-
|
// parameter lets the orchestrator drive partial-tally writes; the HTTP handler
|
||||||
// tally writes; the HTTP handler passes nil for fire-and-forget triggers.
|
// passes nil for fire-and-forget triggers.
|
||||||
type ScanTrigger interface {
|
type ScanTrigger interface {
|
||||||
Scan(ctx context.Context, progressCb func(library.Stats)) (library.Stats, error)
|
Scan(ctx context.Context, progressCb func(library.Stats)) (library.Stats, error)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user