1
0
mirror of https://github.com/golang/go synced 2024-11-17 20:04:47 -07:00

net: retighten test harnesses for dial cancelation

Updates #11225.

Change-Id: I6c33d577f144643781f370ba2ab0997d1c1a3820
Reviewed-on: https://go-review.googlesource.com/17880
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Mikio Hara 2015-12-16 09:35:23 +09:00
parent 3cc24aa9ab
commit 1dc2e7b165
2 changed files with 6 additions and 3 deletions

View File

@ -722,7 +722,7 @@ func TestDialCancel(t *testing.T) {
if runtime.GOOS == "plan9" || runtime.GOOS == "nacl" {
// plan9 is not implemented and nacl doesn't have
// external network access.
t.Skip("skipping on %s", runtime.GOOS)
t.Skipf("skipping on %s", runtime.GOOS)
}
onGoBuildFarm := testenv.Builder() != ""
if testing.Short() && !onGoBuildFarm {
@ -767,6 +767,9 @@ func TestDialCancel(t *testing.T) {
c.Close()
t.Fatal("unexpected successful connection")
case err := <-errc:
if perr := parseDialError(err); perr != nil {
t.Error(perr)
}
if ticks < cancelTick {
t.Fatalf("dial error after %d ticks (%d before cancel sent): %v",
ticks, cancelTick-ticks, err)

View File

@ -93,7 +93,7 @@ second:
goto third
}
switch nestedErr {
case errClosing, errMissingAddress:
case errCanceled, errClosing, errMissingAddress:
return nil
}
return fmt.Errorf("unexpected type on 2nd nested level: %T", nestedErr)
@ -413,7 +413,7 @@ second:
goto third
}
switch nestedErr {
case errClosing, errTimeout, ErrWriteToConnected, io.ErrUnexpectedEOF:
case errCanceled, errClosing, errTimeout, ErrWriteToConnected, io.ErrUnexpectedEOF:
return nil
}
return fmt.Errorf("unexpected type on 2nd nested level: %T", nestedErr)