mirror of
https://github.com/golang/go
synced 2024-11-12 09:20:22 -07:00
net: don't miss testing server teardowns when test fails early
Change-Id: I9fa678e43b4ae3970323cac474b5f86d4d933997 Reviewed-on: https://go-review.googlesource.com/9382 Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
8a413752fb
commit
9bef5cfb9b
@ -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) }
|
||||
|
Loading…
Reference in New Issue
Block a user