aboutsummaryrefslogtreecommitdiff
path: root/src/net/http/httputil/reverseproxy_test.go
diff options
context:
space:
mode:
authorapocelipes <seve3r@outlook.com>2024-07-24 10:39:48 +0000
committerGopher Robot <gobot@golang.org>2024-07-25 00:20:13 +0000
commit1d717951f518a9e818e8b98d4daed17756c394ca (patch)
tree9d0d3097e9f47c5e89171e15d05706ea55e2c9ee /src/net/http/httputil/reverseproxy_test.go
parent792a26130347c9b9db344ba56f86645679a1a9d9 (diff)
downloadgo-1d717951f518a9e818e8b98d4daed17756c394ca.tar.xz
net: use slices and maps to clean up tests
Replace reflect.DeepEqual with slices.Equal/maps.Equal, which is much faster. Change-Id: I54600fb63a56460c11d3d5af9072da585e31b1a2 GitHub-Last-Rev: 08c1445ad5be94d071e8ceb4b060b8f4ab0d77ba GitHub-Pull-Request: golang/go#67606 Reviewed-on: https://go-review.googlesource.com/c/go/+/587816 Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Ian Lance Taylor <iant@google.com>
Diffstat (limited to 'src/net/http/httputil/reverseproxy_test.go')
-rw-r--r--src/net/http/httputil/reverseproxy_test.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/net/http/httputil/reverseproxy_test.go b/src/net/http/httputil/reverseproxy_test.go
index eac8b7ec81..67d0e50593 100644
--- a/src/net/http/httputil/reverseproxy_test.go
+++ b/src/net/http/httputil/reverseproxy_test.go
@@ -205,7 +205,7 @@ func TestReverseProxyStripHeadersPresentInConnection(t *testing.T) {
slices.Sort(cf)
expectedValues := []string{"Upgrade", someConnHeader, fakeConnectionToken}
slices.Sort(expectedValues)
- if !reflect.DeepEqual(cf, expectedValues) {
+ if !slices.Equal(cf, expectedValues) {
t.Errorf("handler modified header %q = %q; want %q", "Connection", cf, expectedValues)
}
}))
@@ -765,7 +765,7 @@ func TestReverseProxyGetPutBuffer(t *testing.T) {
wantLog := []string{"getBuf", "putBuf-" + strconv.Itoa(size)}
mu.Lock()
defer mu.Unlock()
- if !reflect.DeepEqual(log, wantLog) {
+ if !slices.Equal(log, wantLog) {
t.Errorf("Log events = %q; want %q", log, wantLog)
}
}