]> Sergey Matveev's repositories - btrtrc.git/blobdiff - torrent_test.go
Ability to override fifos/
[btrtrc.git] / torrent_test.go
index bd5db3d42ef1e175515e50f5a9631c14cd14aafd..ce0af9f4e7693a47fee41b18503a6581ce1d4d09 100644 (file)
@@ -89,6 +89,7 @@ func BenchmarkUpdatePiecePriorities(b *testing.B) {
                PieceLength: pieceLength,
                Length:      pieceLength * numPieces,
        }))
+       t.onSetInfo()
        assert.EqualValues(b, 13410, t.numPieces())
        for i := 0; i < 7; i += 1 {
                r := t.NewReader()
@@ -101,7 +102,7 @@ func BenchmarkUpdatePiecePriorities(b *testing.B) {
        }
        t.DownloadPieces(0, t.numPieces())
        for i := 0; i < b.N; i += 1 {
-               t.updateAllPiecePriorities()
+               t.updateAllPiecePriorities("")
        }
 }
 
@@ -128,6 +129,7 @@ func testEmptyFilesAndZeroPieceLength(t *testing.T, cfg *ClientConfig) {
        defer tt.Drop()
        tt.DownloadAll()
        require.True(t, cl.WaitAll())
+       assert.True(t, tt.Complete.Bool())
        assert.True(t, missinggo.FilePathExists(fp))
 }
 
@@ -141,9 +143,7 @@ func TestEmptyFilesAndZeroPieceLengthWithFileStorage(t *testing.T) {
 
 func TestPieceHashFailed(t *testing.T) {
        mi := testutil.GreetingMetaInfo()
-       cl := new(Client)
-       cl.config = TestingConfig(t)
-       cl.initLogger()
+       cl := newTestingClient(t)
        tt := cl.newTorrent(mi.HashInfoBytes(), badStorage{})
        tt.setChunkSize(2)
        require.NoError(t, tt.setInfoBytesLocked(mi.InfoBytes))
@@ -162,6 +162,8 @@ func TestPieceHashFailed(t *testing.T) {
 func TestTorrentMetainfoIncompleteMetadata(t *testing.T) {
        cfg := TestingConfig(t)
        cfg.Debug = true
+       // Disable this just because we manually initiate a connection without it.
+       cfg.MinPeerExtensions.SetBit(pp.ExtensionBitFast, false)
        cl, err := NewClient(cfg)
        require.NoError(t, err)
        defer cl.Close()