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 tt, new, err := cl.AddTorrentSpec(&TorrentSpec{
29 Storage: storage.NewMMap(td),
30 InfoHash: mi.HashInfoBytes(),
31 InfoBytes: mi.InfoBytes,
33 require.NoError(t, err)
38 io.Copy(ioutil.Discard, r)