Compare commits

...

14 Commits

Author SHA1 Message Date
Mark Rushakoff
4a9f286908 Merge remote-tracking branch 'origin/master' into mr/short-tests 2022-07-29 09:26:16 -04:00
Mark Rushakoff
4688d1a662 Skip long internal/mempool 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/mempool from about 19.4s to about 1.4s.
2022-07-22 14:03:02 -04:00
Mark Rushakoff
a730905d6e Skip long cmd/tendermint/commands 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 cmd/tendermint/commands from about 5.8s to about 0.5s.
2022-07-22 13:57:33 -04:00
Mark Rushakoff
7b853328c1 Skip long rpc/jsonrpc 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 rpc/jsonrpc from about 8.3s to about 2.3s.
2022-07-22 13:54:03 -04:00
Mark Rushakoff
d0a88e5d2d Skip long rpc/jsonrpc/client 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 rpc/jsonrpc/client from about 9.2s to about 0.5s.
2022-07-22 13:52:27 -04:00
Mark Rushakoff
9918b6e89f Skip long light/provider/http 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 light/provider/http from about 20s to about 0.3s.
2022-07-22 11:59:12 -04:00
Mark Rushakoff
6daef21b52 Skip long internal/p2p/conn 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/p2p/conn from about 21.7s to about 1.9s.
2022-07-22 11:51:21 -04:00
Mark Rushakoff
4ee92a6a15 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.
2022-07-22 11:47:28 -04:00
Mark Rushakoff
76effdb618 Skip long internal/p2p 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/p2p from about 29s to about 5.4s.
2022-07-22 11:34:44 -04:00
Mark Rushakoff
4f0a85272e 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.
2022-07-22 11:27:02 -04:00
Mark Rushakoff
e08cb3cb8e Skip long light 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 light from about 21s to about 0.9s.
2022-07-22 11:22:10 -04:00
Mark Rushakoff
2cdf1f0806 Skip long rpc/client 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 rpc/client from about 28s to about 3.6s.
2022-07-22 11:17:04 -04:00
Mark Rushakoff
af1f81072d Skip long internal/statesync 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/statesync from about 54s to about 1.5s.
2022-07-22 11:06:54 -04:00
Mark Rushakoff
d074a59bb5 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.
2022-07-22 10:53:34 -04:00
24 changed files with 217 additions and 2 deletions

View File

@@ -15,6 +15,10 @@ import (
)
func TestRollbackIntegration(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode")
}
var height int64
dir := t.TempDir()
ctx, cancel := context.WithCancel(context.Background())

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)

View File

@@ -132,6 +132,10 @@ func convertTex(in []testTx) types.Txs {
}
func TestTxMempool_TxsAvailable(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode")
}
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
@@ -540,6 +544,10 @@ func TestTxMempool_CheckTxSameSender(t *testing.T) {
}
func TestTxMempool_ConcurrentTxs(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode")
}
ctx, cancel := context.WithCancel(context.Background())
defer cancel()

View File

@@ -315,6 +315,10 @@ func TestMConnectionMultiplePings(t *testing.T) {
}
func TestMConnectionPingPongs(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode")
}
// check that we are not leaking any go-routines
t.Cleanup(leaktest.CheckTimeout(t, 10*time.Second))
@@ -558,6 +562,10 @@ func TestMConnectionReadErrorUnknownMsgType(t *testing.T) {
}
func TestMConnectionTrySend(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode")
}
server, client := net.Pipe()
t.Cleanup(closeAll(t, client, server))
ctx, cancel := context.WithCancel(context.Background())
@@ -606,6 +614,10 @@ func TestConnVectors(t *testing.T) {
}
func TestMConnectionChannelOverflow(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode")
}
chOnErr := make(chan struct{})
chOnRcv := make(chan struct{})

View File

@@ -296,6 +296,10 @@ func TestPeerManager_DialNext(t *testing.T) {
}
func TestPeerManager_DialNext_Retry(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode")
}
ctx, cancel := context.WithCancel(context.Background())
defer cancel()

View File

@@ -41,6 +41,10 @@ func echoReactor(ctx context.Context, channel p2p.Channel) {
}
func TestRouter_Network(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode")
}
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
@@ -162,6 +166,10 @@ func TestRouter_Channel_Basic(t *testing.T) {
// Channel tests are hairy to mock, so we use an in-memory network instead.
func TestRouter_Channel_SendReceive(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode")
}
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
@@ -224,6 +232,10 @@ func TestRouter_Channel_SendReceive(t *testing.T) {
}
func TestRouter_Channel_Broadcast(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode")
}
t.Cleanup(leaktest.Check(t))
ctx, cancel := context.WithCancel(context.Background())
@@ -255,6 +267,10 @@ func TestRouter_Channel_Broadcast(t *testing.T) {
}
func TestRouter_Channel_Wrapper(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode")
}
t.Cleanup(leaktest.Check(t))
ctx, cancel := context.WithCancel(context.Background())
@@ -443,6 +459,11 @@ func TestRouter_AcceptPeers(t *testing.T) {
}
func TestRouter_AcceptPeers_Errors(t *testing.T) {
if testing.Short() {
// Each subtest takes more than one second due to the time.Sleep call,
// so just skip from the parent test in short mode.
t.Skip("skipping test in short mode")
}
for _, err := range []error{io.EOF, context.Canceled, context.DeadlineExceeded} {
t.Run(err.Error(), func(t *testing.T) {
@@ -480,9 +501,7 @@ func TestRouter_AcceptPeers_Errors(t *testing.T) {
router.Stop()
mockTransport.AssertExpectations(t)
})
}
}
@@ -811,6 +830,10 @@ func TestRouter_EvictPeers(t *testing.T) {
}
func TestRouter_ChannelCompatability(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode")
}
t.Cleanup(leaktest.Check(t))
ctx, cancel := context.WithCancel(context.Background())
defer cancel()

View File

@@ -59,6 +59,10 @@ func TestMConnTransport_AcceptBeforeListen(t *testing.T) {
}
func TestMConnTransport_AcceptMaxAcceptedConnections(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode")
}
ctx, cancel := context.WithCancel(context.Background())
defer cancel()

View File

@@ -126,6 +126,10 @@ func TestBlockQueueWithFailures(t *testing.T) {
// Test that when all the blocks are retrieved that the queue still holds on to
// it's workers and in the event of failure can still fetch the failed block
func TestBlockQueueBlocks(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode")
}
peerID, err := types.NewNodeID("0011223344556677889900112233445566778899")
require.NoError(t, err)
queue := newBlockQueue(startHeight, stopHeight, 1, stopTime, 2)
@@ -176,6 +180,10 @@ loop:
}
func TestBlockQueueAcceptsNoMoreBlocks(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode")
}
peerID, err := types.NewNodeID("0011223344556677889900112233445566778899")
require.NoError(t, err)
queue := newBlockQueue(startHeight, stopHeight, 1, stopTime, 1)

View File

@@ -197,6 +197,10 @@ func setup(
}
func TestReactor_Sync(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode")
}
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Minute)
defer cancel()
@@ -618,6 +622,10 @@ func TestReactor_StateProviderP2P(t *testing.T) {
}
func TestReactor_Backfill(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode")
}
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
@@ -626,6 +634,10 @@ func TestReactor_Backfill(t *testing.T) {
for _, failureRate := range failureRates {
failureRate := failureRate
t.Run(fmt.Sprintf("failure rate: %d", failureRate), func(t *testing.T) {
if testing.Short() && failureRate > 0 {
t.Skip("skipping test in short mode")
}
ctx, cancel := context.WithCancel(ctx)
defer cancel()

View File

@@ -22,6 +22,10 @@ import (
)
func TestSyncer_SyncAny(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode")
}
ctx, cancel := context.WithCancel(context.Background())
defer cancel()

View File

@@ -235,6 +235,10 @@ func TestLightClientAttackEvidence_Equivocation(t *testing.T) {
}
func TestLightClientAttackEvidence_ForwardLunatic(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode")
}
// primary performs a lunatic attack but changes the time of the header to
// something in the future relative to the blockchain
var (

View File

@@ -17,6 +17,10 @@ import (
// Manually getting light blocks and verifying them.
func TestExampleClient(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode")
}
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
conf, err := rpctest.CreateConfig(t, "ExampleClient_VerifyLightBlockAtHeight")

View File

@@ -23,6 +23,10 @@ import (
// Automatically getting new headers and verifying them.
func TestClientIntegration_Update(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode")
}
t.Parallel()
ctx, cancel := context.WithCancel(context.Background())
@@ -84,6 +88,10 @@ func TestClientIntegration_Update(t *testing.T) {
// Manually getting light blocks and verifying them.
func TestClientIntegration_VerifyLightBlockAtHeight(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode")
}
t.Parallel()
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
@@ -162,6 +170,10 @@ func waitForBlock(ctx context.Context, p provider.Provider, height int64) (*type
}
func TestClientStatusRPC(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode")
}
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
conf, err := rpctest.CreateConfig(t, t.Name())

View File

@@ -33,6 +33,10 @@ func TestNewProvider(t *testing.T) {
}
func TestProvider(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode")
}
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
cfg, err := rpctest.CreateConfig(t, t.Name())

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

View File

@@ -18,6 +18,10 @@ import (
)
func TestHTTPSimple(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode")
}
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
@@ -68,6 +72,10 @@ func TestHTTPSimple(t *testing.T) {
}
func TestHTTPBatching(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode")
}
ctx, cancel := context.WithCancel(context.Background())
defer cancel()

View File

@@ -15,6 +15,10 @@ import (
)
func TestWaitForHeight(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode")
}
ctx, cancel := context.WithCancel(context.Background())
defer cancel()

View File

@@ -133,6 +133,10 @@ func TestClientOperations(t *testing.T) {
})
t.Run("Batching", func(t *testing.T) {
t.Run("JSONRPCCalls", func(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode")
}
logger := log.NewTestingLogger(t)
c := getHTTPClient(t, logger, conf)
testBatchedJSONRPCCalls(ctx, t, c)
@@ -171,6 +175,10 @@ func TestClientOperations(t *testing.T) {
require.Zero(t, batch.Clear(), "clearing an empty batch of JSON RPC requests should result in a 0 result")
})
t.Run("ConcurrentJSONRPC", func(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode")
}
logger := log.NewTestingLogger(t)
var wg sync.WaitGroup
@@ -291,6 +299,10 @@ func TestClientMethodCalls(t *testing.T) {
"first: %+v, doc: %s", first, string(doc))
})
t.Run("ABCIQuery", func(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode")
}
// write something
k, v, tx := MakeTxKV()
status, err := c.Status(ctx)
@@ -309,6 +321,10 @@ func TestClientMethodCalls(t *testing.T) {
}
})
t.Run("AppCalls", func(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode")
}
// get an offset of height to avoid racing and guessing
s, err := c.Status(ctx)
require.NoError(t, err)
@@ -409,6 +425,10 @@ func TestClientMethodCalls(t *testing.T) {
// XXX Test proof
})
t.Run("BlockchainInfo", func(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode")
}
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
@@ -439,6 +459,10 @@ func TestClientMethodCalls(t *testing.T) {
assert.Contains(t, err.Error(), "can't be greater than max")
})
t.Run("BroadcastTxCommit", func(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode")
}
_, _, tx := MakeTxKV()
bres, err := c.BroadcastTxCommit(ctx, tx)
require.NoError(t, err, "%d: %+v", i, err)
@@ -481,6 +505,10 @@ func TestClientMethodCalls(t *testing.T) {
// TODO: more checks...
})
t.Run("Block", func(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode")
}
const subscriber = "TestBlockEvents"
eventCh, err := c.Subscribe(ctx, subscriber, types.QueryForEvent(types.EventNewBlockValue).String())
@@ -515,6 +543,10 @@ func TestClientMethodCalls(t *testing.T) {
})
t.Run("Evidence", func(t *testing.T) {
t.Run("BroadcastDuplicateVote", func(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode")
}
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
@@ -722,6 +754,10 @@ func TestClientMethodCallsAdvanced(t *testing.T) {
}
})
t.Run("TxSearchWithTimeout", func(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode")
}
logger := log.NewTestingLogger(t)
timeoutClient := getHTTPClientWithTimeout(t, logger, conf, 10*time.Second)

View File

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

View File

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

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{