10 "github.com/stretchr/testify/assert"
11 "github.com/stretchr/testify/require"
12 "golang.org/x/time/rate"
14 "github.com/anacrolix/torrent/internal/testutil"
15 "github.com/anacrolix/torrent/storage"
18 func TestDropTorrentWithMmapStorageWhileHashing(t *testing.T) {
19 cfg := TestingConfig(t)
20 // Ensure the data is present when the torrent is added, and not obtained
21 // over the network as the test runs.
22 cfg.DownloadRateLimiter = rate.NewLimiter(0, 0)
23 cl, err := NewClient(cfg)
24 require.NoError(t, err)
27 td, mi := testutil.GreetingTestTorrent()
28 mms := storage.NewMMap(td)
30 tt, new, err := cl.AddTorrentSpec(&TorrentSpec{
32 InfoHash: mi.HashInfoBytes(),
33 InfoBytes: mi.InfoBytes,
35 require.NoError(t, err)
40 io.Copy(io.Discard, r)