+//go:build !wasm
+// +build !wasm
+
package torrent
import (
)
func TestDropTorrentWithMmapStorageWhileHashing(t *testing.T) {
- cfg := TestingConfig()
+ cfg := TestingConfig(t)
// Ensure the data is present when the torrent is added, and not obtained
// over the network as the test runs.
cfg.DownloadRateLimiter = rate.NewLimiter(0, 0)
defer cl.Close()
td, mi := testutil.GreetingTestTorrent()
+ mms := storage.NewMMap(td)
+ defer mms.Close()
tt, new, err := cl.AddTorrentSpec(&TorrentSpec{
- Storage: storage.NewMMap(td),
+ Storage: mms,
InfoHash: mi.HashInfoBytes(),
InfoBytes: mi.InfoBytes,
})
require.NoError(t, err)
assert.True(t, new)
- // Make sure some of the data is actually there.
- sub := tt.SubscribePieceStateChanges()
- for range sub.Values {
- if tt.BytesCompleted() > 0 {
- break
- }
- }
- sub.Close()
-
r := tt.NewReader()
go tt.Drop()
io.Copy(ioutil.Discard, r)