aboutsummaryrefslogtreecommitdiff
path: root/src/net/http/main_test.go
diff options
context:
space:
mode:
authorBrad Fitzpatrick <bradfitz@golang.org>2016-01-04 18:27:51 +0000
committerBrad Fitzpatrick <bradfitz@golang.org>2016-01-04 19:23:17 +0000
commit28b95edff2108c5e567debbf5e65db1a94c2ef39 (patch)
treef73effa209fa1524f0e72dd167ff858694794c0c /src/net/http/main_test.go
parentfa8384dfb9d229269cca4e176a1870b776894552 (diff)
downloadgo-28b95edff2108c5e567debbf5e65db1a94c2ef39.tar.xz
net/http: deflake tests in full mode after t.Parallel additions
https://golang.org/cl/18087 added a bunch of t.Parallel calls, which aren't compatible with the afterTest func. But in short mode, afterTest is a no-op. To keep all.bash (short mode) fast, conditionally set t.Parallel when in short mode, but keep it unset for compatibility with afterFunc otherwise. Fixes #13804 Change-Id: Ie841fbc2544e1ffbee43ba1afbe895774e290da0 Reviewed-on: https://go-review.googlesource.com/18143 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/net/http/main_test.go')
-rw-r--r--src/net/http/main_test.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/net/http/main_test.go b/src/net/http/main_test.go
index 12eea6f0e1..1163874ac2 100644
--- a/src/net/http/main_test.go
+++ b/src/net/http/main_test.go
@@ -79,6 +79,15 @@ func goroutineLeaked() bool {
return true
}
+// setParallel marks t as a parallel test if we're in short mode
+// (all.bash), but as a serial test otherwise. Using t.Parallel isn't
+// compatible with the afterTest func in non-short mode.
+func setParallel(t *testing.T) {
+ if testing.Short() {
+ t.Parallel()
+ }
+}
+
func afterTest(t testing.TB) {
http.DefaultTransport.(*http.Transport).CloseIdleConnections()
if testing.Short() {