From d074a59bb5c2912e9ac6726620b1b63f8cc3471c Mon Sep 17 00:00:00 2001 From: Mark Rushakoff Date: Fri, 22 Jul 2022 10:53:34 -0400 Subject: [PATCH] Skip long internal/consensus 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 internal/consensus from about 64s to about 10s. --- internal/consensus/byzantine_test.go | 4 ++++ internal/consensus/reactor_test.go | 8 ++++++++ internal/consensus/replay_test.go | 4 ++++ 3 files changed, 16 insertions(+) diff --git a/internal/consensus/byzantine_test.go b/internal/consensus/byzantine_test.go index 9c6f4a295..0c1b47bdc 100644 --- a/internal/consensus/byzantine_test.go +++ b/internal/consensus/byzantine_test.go @@ -33,6 +33,10 @@ import ( // Byzantine node sends two different prevotes (nil and blockID) to the same // validator. func TestByzantinePrevoteEquivocation(t *testing.T) { + if testing.Short() { + t.Skip("skipping test in short mode") + } + // empirically, this test either passes in <1s or hits some // kind of deadlock and hit the larger timeout. This timeout // can be extended a bunch if needed, but it's good to avoid diff --git a/internal/consensus/reactor_test.go b/internal/consensus/reactor_test.go index d848f53e7..8536fd0d2 100644 --- a/internal/consensus/reactor_test.go +++ b/internal/consensus/reactor_test.go @@ -779,6 +779,10 @@ func TestReactorRecordsVotesAndBlockParts(t *testing.T) { } func TestReactorVotingPowerChange(t *testing.T) { + if testing.Short() { + t.Skip("skipping test in short mode") + } + ctx, cancel := context.WithTimeout(context.Background(), time.Minute) defer cancel() @@ -885,6 +889,10 @@ func TestReactorVotingPowerChange(t *testing.T) { } func TestReactorValidatorSetChanges(t *testing.T) { + if testing.Short() { + t.Skip("skipping test in short mode") + } + ctx, cancel := context.WithTimeout(context.Background(), 2*time.Minute) defer cancel() diff --git a/internal/consensus/replay_test.go b/internal/consensus/replay_test.go index 328dba040..2339fa4a5 100644 --- a/internal/consensus/replay_test.go +++ b/internal/consensus/replay_test.go @@ -118,6 +118,10 @@ func sendTxs(ctx context.Context, t *testing.T, cs *State) { // TestWALCrash uses crashing WAL to test we can recover from any WAL failure. func TestWALCrash(t *testing.T) { + if testing.Short() { + t.Skip("skipping test in short mode") + } + testCases := []struct { name string initFn func(dbm.DB, *State, context.Context)