Fix tests panic

This commit is contained in:
pkositsyn 2021-03-17 14:35:09 +03:00 committed by Fedor Korotkiy
parent b4b319671c
commit bd341247d1

View file

@ -99,13 +99,13 @@ func TestFileLeak_PipeNoLeak(t *testing.T) {
func TestFileLeak_SocketLeak(t *testing.T) {
var conn net.Listener
defer conn.Close()
defer func() { conn.Close() }()
checkLeak(t, true, func() {
addr, err := testtool.GetFreePort()
require.NoError(t, err)
conn, err = net.Listen("tcp", addr)
conn, err = net.Listen("tcp", fmt.Sprintf(":%s", addr))
require.NoError(t, err)
})
}
@ -115,7 +115,7 @@ func TestFileLeak_SocketNoLeak(t *testing.T) {
addr, err := testtool.GetFreePort()
require.NoError(t, err)
conn, err := net.Listen("tcp", addr)
conn, err := net.Listen("tcp", fmt.Sprintf(":%s", addr))
require.NoError(t, err)
_ = conn.Close()
})