mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-07 05:46:32 +00:00
Improve handling of -short flag in tests (#9075)
As a small developer quality of life improvement, I found many individual unit tests that take longer than around a second to complete, and set them to skip when run under `go test -short`. On my machine, the wall timings for tests (with `go test -count=1 ./...` and optionally `-short` and `-race`) are roughly: - Long tests, no race detector: about 1m42s - Short tests, no race detector: about 17s - Long tests, race detector enabled: about 2m1s - Short tests, race detector enabled: about 28s This PR is split into many commits each touching a single package, with commit messages detailing the approximate timing change per package.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -340,6 +340,10 @@ func TestRPC(t *testing.T) {
|
||||
}
|
||||
})
|
||||
t.Run("WSClientPingPong", func(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping test in short mode")
|
||||
}
|
||||
|
||||
// TestWSClientPingPong checks that a client & server exchange pings
|
||||
// & pongs so connection stays alive.
|
||||
t.Cleanup(leaktest.CheckTimeout(t, 4*time.Second))
|
||||
|
||||
Reference in New Issue
Block a user