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.
This commit is contained in:
Mark Rushakoff
2022-07-22 13:52:27 -04:00
parent 9918b6e89f
commit d0a88e5d2d

View File

@@ -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