This shouldn't need to exist in general, but in practice I want something
like this a few times per year.
Change-Id: I9c220e58be44b7726f75d776f714212c570cf8bb
Reviewed-on: https://go-review.googlesource.com/18286
Reviewed-by: Russ Cox <rsc@golang.org>
package http_test
import (
+ "flag"
"fmt"
"net/http"
"os"
"time"
)
+var flaky = flag.Bool("flaky", false, "run known-flaky tests too")
+
func TestMain(m *testing.M) {
v := m.Run()
if v == 0 && goroutineLeaked() {
}
}
+func setFlaky(t *testing.T, issue int) {
+ if !*flaky {
+ t.Skipf("skipping known flaky test; see golang.org/issue/%d", issue)
+ }
+}
+
func afterTest(t testing.TB) {
http.DefaultTransport.(*http.Transport).CloseIdleConnections()
if testing.Short() {
// Issue 11020. The returned error message should be errRequestCanceled
func TestTransportCancelBeforeResponseHeaders(t *testing.T) {
- t.Skip("Skipping flaky test; see Issue 11894")
+ setFlaky(t, 11894)
defer afterTest(t)
serverConnCh := make(chan net.Conn, 1)