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:
parent
3cc24aa9ab
commit
1dc2e7b165
@ -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)
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user