Skip to content

Commit 23d0300

Browse files
committed
http2: remove use of DeepEqual for testing errors
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]>
1 parent 533bb77 commit 23d0300

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

http2_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,16 @@ func waitErrCondition(waitFor, checkEvery time.Duration, fn func() error) error
226226
return err
227227
}
228228

229+
func equalError(a, b error) bool {
230+
if a == nil {
231+
return b == nil
232+
}
233+
if b == nil {
234+
return a == nil
235+
}
236+
return a.Error() == b.Error()
237+
}
238+
229239
// Tests that http2.Server.IdleTimeout is initialized from
230240
// http.Server.{Idle,Read}Timeout. http.Server.IdleTimeout was
231241
// added in Go 1.8.

server_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3526,7 +3526,7 @@ func TestCheckValidHTTP2Request(t *testing.T) {
35263526
}
35273527
for i, tt := range tests {
35283528
got := checkValidHTTP2RequestHeaders(tt.h)
3529-
if !reflect.DeepEqual(got, tt.want) {
3529+
if !equalError(got, tt.want) {
35303530
t.Errorf("%d. checkValidHTTP2Request = %v; want %v", i, got, tt.want)
35313531
}
35323532
}

0 commit comments

Comments
 (0)