From 1473789b74d69ba3d27c4880d2a8b442151e784d Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Wed, 18 Apr 2018 17:17:26 +0000 Subject: [PATCH] net/http: remove stderr log spam in test Fixes #24831 Change-Id: Icd39093d1b7d9b25aa8374c0298cdb1dea48e672 Reviewed-on: https://go-review.googlesource.com/107817 Run-TryBot: Brad Fitzpatrick TryBot-Result: Gobot Gobot Reviewed-by: Andrew Bonventre --- src/net/http/transport_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/net/http/transport_test.go b/src/net/http/transport_test.go index a48e61e9ba1..693d3f5b814 100644 --- a/src/net/http/transport_test.go +++ b/src/net/http/transport_test.go @@ -3731,6 +3731,10 @@ func TestTransportEventTraceTLSVerify(t *testing.T) { t.Error("Unexpected request") })) defer ts.Close() + ts.Config.ErrorLog = log.New(funcWriter(func(p []byte) (int, error) { + logf("%s", p) + return len(p), nil + }), "", 0) certpool := x509.NewCertPool() certpool.AddCert(ts.Certificate()) @@ -4424,3 +4428,7 @@ func TestNoBodyOnChunked304Response(t *testing.T) { t.Errorf("Unexpected body on 304 response") } } + +type funcWriter func([]byte) (int, error) + +func (f funcWriter) Write(p []byte) (int, error) { return f(p) }