diff --git a/client_test.go b/client_test.go index 95c0face..1000c3b0 100644 --- a/client_test.go +++ b/client_test.go @@ -592,6 +592,7 @@ func TestPieceCompletedInStorageButNotClient(t *testing.T) { cfg.DataDir = greetingTempDir seeder, err := NewClient(TestingConfig(t)) require.NoError(t, err) + defer seeder.Close() seeder.AddTorrentSpec(&TorrentSpec{ InfoBytes: greetingMetainfo.InfoBytes, }) diff --git a/issue97_test.go b/issue97_test.go index 09a18b15..ee8107c6 100644 --- a/issue97_test.go +++ b/issue97_test.go @@ -12,8 +12,10 @@ import ( func TestHashPieceAfterStorageClosed(t *testing.T) { td := t.TempDir() + cs := storage.NewFile(td) + defer cs.Close() tt := &Torrent{ - storageOpener: storage.NewClient(storage.NewFile(td)), + storageOpener: storage.NewClient(cs), logger: log.Default, chunkSize: defaultChunkSize, } diff --git a/network_test.go b/network_test.go index 5e912cc4..a1fd8806 100644 --- a/network_test.go +++ b/network_test.go @@ -71,5 +71,11 @@ func TestListenLocalhostNetwork(t *testing.T) { testListenerNetwork(t, listenUtpListener, "udp", "udp6", "[::]:0", false) testListenerNetwork(t, listenUtpListener, "udp", "udp4", "localhost:0", true) - testAcceptedConnAddr(t, "tcp", false, dialClosure(net.Dial, "tcp"), listenClosure(net.Listen, "tcp6", ":0")) + testAcceptedConnAddr( + t, + "tcp", + false, + dialClosure(net.Dial, "tcp"), + listenClosure(net.Listen, "tcp6", "localhost:0"), + ) }