]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Fix some testing code for Config->ClientConfig
authorMatt Joiner <anacrolix@gmail.com>
Sat, 16 Jun 2018 07:01:21 +0000 (17:01 +1000)
committerMatt Joiner <anacrolix@gmail.com>
Sat, 16 Jun 2018 07:01:21 +0000 (17:01 +1000)
torrent_test.go

index c9ea5e42841f8834d1a7882b422f4ed3b95301d3..33eb49035cfc725c704722572cba0a3fc80f5baa 100644 (file)
@@ -80,7 +80,7 @@ func BenchmarkUpdatePiecePriorities(b *testing.B) {
                numPieces   = 13410
                pieceLength = 256 << 10
        )
-       cl := &Client{}
+       cl := &Client{config: &ClientConfig{}}
        cl.initLogger()
        t := cl.newTorrent(metainfo.Hash{}, nil)
        require.NoError(b, t.setInfo(&metainfo.Info{
@@ -107,7 +107,7 @@ func BenchmarkUpdatePiecePriorities(b *testing.B) {
 // Check that a torrent containing zero-length file(s) will start, and that
 // they're created in the filesystem. The client storage is assumed to be
 // file-based on the native filesystem based.
-func testEmptyFilesAndZeroPieceLength(t *testing.T, cfg *Config) {
+func testEmptyFilesAndZeroPieceLength(t *testing.T, cfg *ClientConfig) {
        cl, err := NewClient(cfg)
        require.NoError(t, err)
        defer cl.Close()
@@ -149,6 +149,7 @@ func TestEmptyFilesAndZeroPieceLengthWithMMapStorage(t *testing.T) {
 func TestPieceHashFailed(t *testing.T) {
        mi := testutil.GreetingMetaInfo()
        cl := new(Client)
+       cl.config = &ClientConfig{}
        cl.initLogger()
        tt := cl.newTorrent(mi.HashInfoBytes(), badStorage{})
        tt.setChunkSize(2)