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