From 88d150b933f0d83dbfea900c107a3d8f68a0e74a Mon Sep 17 00:00:00 2001 From: Levi Date: Mon, 21 Sep 2026 22:30:54 +0800 Subject: [PATCH] test(bt): isolate cleanup fixtures from part-file promotion (#1531) --- internal/protocol/bt/selection_test.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/internal/protocol/bt/selection_test.go b/internal/protocol/bt/selection_test.go index 8c2f9773..b5197f63 100644 --- a/internal/protocol/bt/selection_test.go +++ b/internal/protocol/bt/selection_test.go @@ -83,10 +83,15 @@ func TestWaitCleansUnselectedFilesFromSharedPiece(t *testing.T) { {Length: 4, Path: []string{"keep.txt"}}, {Length: 4, Path: []string{"nested", "skip.txt"}}, }} - store := storage.NewFileOpts(storage.NewFileClientOpts{ + storageOpts := storage.NewFileClientOpts{ ClientBaseDir: dir, TorrentDirMaker: func(baseDir string, _ *metainfo.Info, _ metainfo.Hash) string { return baseDir }, - }) + } + // VerifyDataContext can return before storage finishes marking the piece + // complete. Disable automatic part-file promotion so it cannot rename + // the .part fixtures that this test creates to exercise cleanup. + storageOpts.UsePartFiles.Set(false) + store := storage.NewFileOpts(storageOpts) defer store.Close() config := torrent.TestingConfig(t) config.DisableTCP = true