Skip long node 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 node from about 7.7s to about 0.9s.

The difference is much more pronounced with the race detector enabled,
about 33s without -short and about 1.4s with -short.
This commit is contained in:
Mark Rushakoff
2022-07-22 11:27:02 -04:00
parent e08cb3cb8e
commit 4f0a85272e
+12
View File
@@ -106,6 +106,10 @@ func getTestNode(ctx context.Context, t *testing.T, conf *config.Config, logger
}
func TestNodeDelayedStart(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode")
}
cfg, err := config.ResetTestRoot(t.TempDir(), "node_delayed_start_test")
require.NoError(t, err)
@@ -195,6 +199,10 @@ func TestNodeSetPrivValTCP(t *testing.T) {
// address without a protocol must result in error
func TestPrivValidatorListenAddrNoProtocol(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode")
}
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
@@ -441,6 +449,10 @@ func TestMaxTxsProposalBlockSize(t *testing.T) {
}
func TestMaxProposalBlockSize(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode")
}
ctx, cancel := context.WithCancel(context.Background())
defer cancel()