Skip long types 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 types from about 21s to about 1.9s with the race detector
enabled. With the race detector disabled, the timing difference is about
1.0s to about 0.3s.
This commit is contained in:
Mark Rushakoff
2022-07-22 11:47:28 -04:00
parent 76effdb618
commit 4ee92a6a15
2 changed files with 20 additions and 0 deletions

View File

@@ -16,6 +16,10 @@ const (
)
func TestBasicPartSet(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode")
}
// Construct random data of size partSize * 100
nParts := 100
data := tmrand.Bytes(testPartSize * nParts)
@@ -64,6 +68,10 @@ func TestBasicPartSet(t *testing.T) {
}
func TestWrongProof(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode")
}
// Construct random data of size partSize * 100
data := tmrand.Bytes(testPartSize * 100)
partSet := NewPartSetFromData(data, testPartSize)
@@ -89,6 +97,10 @@ func TestWrongProof(t *testing.T) {
}
func TestPartSetHeaderValidateBasic(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode")
}
testCases := []struct {
testName string
malleatePartSetHeader func(*PartSetHeader)
@@ -110,6 +122,10 @@ func TestPartSetHeaderValidateBasic(t *testing.T) {
}
func TestPartValidateBasic(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode")
}
testCases := []struct {
testName string
malleatePart func(*Part)

View File

@@ -1207,6 +1207,10 @@ func applyChangesToValSet(t *testing.T, expErr error, valSet *ValidatorSet, vals
}
func TestValSetUpdatePriorityOrderTests(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode")
}
const nMaxElections int32 = 5000
testCases := []testVSetCfg{