Add a test for dropping a torrent before it gets the Info
Really just to check the behaviour doesn't change, it was mentioned before but wasn't the actual cause of any problem.
This commit is contained in:
parent
11d703fbf1
commit
afed0b7ce3
|
@ -15,6 +15,7 @@ import (
|
|||
|
||||
_ "github.com/anacrolix/envpprof"
|
||||
"github.com/anacrolix/missinggo"
|
||||
. "github.com/anacrolix/missinggo"
|
||||
"github.com/anacrolix/utp"
|
||||
"github.com/bradfitz/iter"
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
@ -587,3 +588,20 @@ func TestAddTorrentMetainfoInCache(t *testing.T) {
|
|||
// Obtained from the metainfo cache.
|
||||
require.NotNil(t, tt.Info())
|
||||
}
|
||||
|
||||
func TestTorrentDroppedBeforeGotInfo(t *testing.T) {
|
||||
dir, mi := testutil.GreetingTestTorrent()
|
||||
os.RemoveAll(dir)
|
||||
cl, _ := NewClient(&TestingConfig)
|
||||
defer cl.Close()
|
||||
var ts TorrentSpec
|
||||
CopyExact(&ts.InfoHash, mi.Info.Hash)
|
||||
tt, _, _ := cl.AddTorrentSpec(&ts)
|
||||
tt.Drop()
|
||||
assert.EqualValues(t, 0, len(cl.Torrents()))
|
||||
select {
|
||||
case <-tt.GotInfo():
|
||||
t.FailNow()
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue