Commit 1dc2e7b1 authored by Mikio Hara's avatar Mikio Hara

net: retighten test harnesses for dial cancelation

Updates #11225.

Change-Id: I6c33d577f144643781f370ba2ab0997d1c1a3820
Reviewed-on: https://go-review.googlesource.com/17880Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 3cc24aa9
...@@ -722,7 +722,7 @@ func TestDialCancel(t *testing.T) { ...@@ -722,7 +722,7 @@ func TestDialCancel(t *testing.T) {
if runtime.GOOS == "plan9" || runtime.GOOS == "nacl" { if runtime.GOOS == "plan9" || runtime.GOOS == "nacl" {
// plan9 is not implemented and nacl doesn't have // plan9 is not implemented and nacl doesn't have
// external network access. // external network access.
t.Skip("skipping on %s", runtime.GOOS) t.Skipf("skipping on %s", runtime.GOOS)
} }
onGoBuildFarm := testenv.Builder() != "" onGoBuildFarm := testenv.Builder() != ""
if testing.Short() && !onGoBuildFarm { if testing.Short() && !onGoBuildFarm {
...@@ -767,6 +767,9 @@ func TestDialCancel(t *testing.T) { ...@@ -767,6 +767,9 @@ func TestDialCancel(t *testing.T) {
c.Close() c.Close()
t.Fatal("unexpected successful connection") t.Fatal("unexpected successful connection")
case err := <-errc: case err := <-errc:
if perr := parseDialError(err); perr != nil {
t.Error(perr)
}
if ticks < cancelTick { if ticks < cancelTick {
t.Fatalf("dial error after %d ticks (%d before cancel sent): %v", t.Fatalf("dial error after %d ticks (%d before cancel sent): %v",
ticks, cancelTick-ticks, err) ticks, cancelTick-ticks, err)
......
...@@ -93,7 +93,7 @@ second: ...@@ -93,7 +93,7 @@ second:
goto third goto third
} }
switch nestedErr { switch nestedErr {
case errClosing, errMissingAddress: case errCanceled, errClosing, errMissingAddress:
return nil return nil
} }
return fmt.Errorf("unexpected type on 2nd nested level: %T", nestedErr) return fmt.Errorf("unexpected type on 2nd nested level: %T", nestedErr)
...@@ -413,7 +413,7 @@ second: ...@@ -413,7 +413,7 @@ second:
goto third goto third
} }
switch nestedErr { switch nestedErr {
case errClosing, errTimeout, ErrWriteToConnected, io.ErrUnexpectedEOF: case errCanceled, errClosing, errTimeout, ErrWriteToConnected, io.ErrUnexpectedEOF:
return nil return nil
} }
return fmt.Errorf("unexpected type on 2nd nested level: %T", nestedErr) return fmt.Errorf("unexpected type on 2nd nested level: %T", nestedErr)
......
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