Commit 9bef5cfb authored by Mikio Hara's avatar Mikio Hara

net: don't miss testing server teardowns when test fails early

Change-Id: I9fa678e43b4ae3970323cac474b5f86d4d933997
Reviewed-on: https://go-review.googlesource.com/9382Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
parent 8a413752
......@@ -69,6 +69,11 @@ func TestTCPServer(t *testing.T) {
var lss []*localServer
var tpchs []chan error
defer func() {
for _, ls := range lss {
ls.teardown()
}
}()
for i := 0; i < N; i++ {
ls, err := (&streamListener{Listener: ln}).newLocalServer()
if err != nil {
......@@ -77,11 +82,6 @@ func TestTCPServer(t *testing.T) {
lss = append(lss, ls)
tpchs = append(tpchs, make(chan error, 1))
}
defer func() {
for _, ls := range lss {
ls.teardown()
}
}()
for i := 0; i < N; i++ {
ch := tpchs[i]
handler := func(ls *localServer, ln Listener) { transponder(ln, ch) }
......@@ -153,6 +153,11 @@ func TestUnixAndUnixpacketServer(t *testing.T) {
var lss []*localServer
var tpchs []chan error
defer func() {
for _, ls := range lss {
ls.teardown()
}
}()
for i := 0; i < N; i++ {
ls, err := (&streamListener{Listener: ln}).newLocalServer()
if err != nil {
......@@ -161,11 +166,6 @@ func TestUnixAndUnixpacketServer(t *testing.T) {
lss = append(lss, ls)
tpchs = append(tpchs, make(chan error, 1))
}
defer func() {
for _, ls := range lss {
ls.teardown()
}
}()
for i := 0; i < N; i++ {
ch := tpchs[i]
handler := func(ls *localServer, ln Listener) { transponder(ln, ch) }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment