Skip to content

Commit

Permalink
http2: remove use of DeepEqual for testing errors
Browse files Browse the repository at this point in the history
Comparing errors using DeepEqual breaks if frame information
is added as proposed in golang/go#29934.

Updates golang/go#29934

Change-Id: Ia2eb3f5ae2bdeac322b34e12d8e732174b9bd355
Reviewed-on: https://go-review.googlesource.com/c/164517
Run-TryBot: Brad Fitzpatrick <[email protected]>
Reviewed-by: Damien Neil <[email protected]>
  • Loading branch information
bradfitz committed Feb 28, 2019
1 parent 533bb77 commit 23d0300
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions http2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,16 @@ func waitErrCondition(waitFor, checkEvery time.Duration, fn func() error) error
return err
}

func equalError(a, b error) bool {
if a == nil {
return b == nil
}
if b == nil {
return a == nil
}
return a.Error() == b.Error()
}

// Tests that http2.Server.IdleTimeout is initialized from
// http.Server.{Idle,Read}Timeout. http.Server.IdleTimeout was
// added in Go 1.8.
Expand Down
2 changes: 1 addition & 1 deletion server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3526,7 +3526,7 @@ func TestCheckValidHTTP2Request(t *testing.T) {
}
for i, tt := range tests {
got := checkValidHTTP2RequestHeaders(tt.h)
if !reflect.DeepEqual(got, tt.want) {
if !equalError(got, tt.want) {
t.Errorf("%d. checkValidHTTP2Request = %v; want %v", i, got, tt.want)
}
}
Expand Down

0 comments on commit 23d0300

Please sign in to comment.