From d0a88e5d2d3495ea666b84b0a489ddd27100e669 Mon Sep 17 00:00:00 2001 From: Mark Rushakoff Date: Fri, 22 Jul 2022 13:52:27 -0400 Subject: [PATCH] Skip long rpc/jsonrpc/client tests in -short mode I added checks against testing.Short for tests that took longer than about one second on my machine. Running with -short reduces the test time of rpc/jsonrpc/client from about 9.2s to about 0.5s. --- rpc/jsonrpc/client/ws_client_test.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/rpc/jsonrpc/client/ws_client_test.go b/rpc/jsonrpc/client/ws_client_test.go index 5bbb5fc25..0434f6461 100644 --- a/rpc/jsonrpc/client/ws_client_test.go +++ b/rpc/jsonrpc/client/ws_client_test.go @@ -65,6 +65,10 @@ func (h *myTestHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { } func TestWSClientReconnectsAfterReadFailure(t *testing.T) { + if testing.Short() { + t.Skip("skipping test in short mode") + } + t.Cleanup(leaktest.Check(t)) // start server @@ -97,6 +101,10 @@ func TestWSClientReconnectsAfterReadFailure(t *testing.T) { } func TestWSClientReconnectsAfterWriteFailure(t *testing.T) { + if testing.Short() { + t.Skip("skipping test in short mode") + } + t.Cleanup(leaktest.Check(t)) // start server @@ -127,6 +135,10 @@ func TestWSClientReconnectsAfterWriteFailure(t *testing.T) { } func TestWSClientReconnectFailure(t *testing.T) { + if testing.Short() { + t.Skip("skipping test in short mode") + } + t.Cleanup(leaktest.Check(t)) // start server