Test fixes for Windows

This commit is contained in:
Matt Joiner 2023-05-27 14:57:41 +10:00
parent dee985f9bd
commit 702b2c77a0
No known key found for this signature in database
GPG Key ID: 6B990B8185E7F782
3 changed files with 11 additions and 2 deletions

View File

@ -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,
})

View File

@ -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,
}

View File

@ -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"),
)
}