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.
This commit is contained in:
Mark Rushakoff
2022-07-22 10:53:34 -04:00
parent 65c0fba564
commit d074a59bb5
3 changed files with 16 additions and 0 deletions

View File

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

View File

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

View File

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