From 8be02bc700c514b14799a720edfdb84875098a20 Mon Sep 17 00:00:00 2001 From: Wondertan Date: Fri, 7 Oct 2022 18:09:15 +0200 Subject: [PATCH] tests(node): increase test timeouts to 5 min It's very likely that introduction of new App into Swamp brings more CPU usage subsequently increasing the time CI needs to finish tests --- nodebuilder/tests/fraud_test.go | 4 ++-- nodebuilder/tests/p2p_test.go | 8 ++++---- nodebuilder/tests/reconstruct_test.go | 5 +++-- nodebuilder/tests/sync_test.go | 10 +++++----- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/nodebuilder/tests/fraud_test.go b/nodebuilder/tests/fraud_test.go index 102eb86897..d8b070f90d 100644 --- a/nodebuilder/tests/fraud_test.go +++ b/nodebuilder/tests/fraud_test.go @@ -35,7 +35,7 @@ func TestFraudProofBroadcasting(t *testing.T) { bridge := sw.NewBridgeNode(core.WithHeaderConstructFn(header.FraudMaker(t, 20))) - ctx, cancel := context.WithTimeout(context.Background(), time.Minute) + ctx, cancel := context.WithTimeout(context.Background(), time.Minute*5) t.Cleanup(cancel) err := bridge.Start(ctx) @@ -107,7 +107,7 @@ func TestFraudProofSyncing(t *testing.T) { store := nodebuilder.MockStore(t, cfg) bridge := sw.NewNodeWithStore(node.Bridge, store, core.WithHeaderConstructFn(header.FraudMaker(t, 10))) - ctx, cancel := context.WithTimeout(context.Background(), time.Minute) + ctx, cancel := context.WithTimeout(context.Background(), time.Minute*5) t.Cleanup(cancel) err := bridge.Start(ctx) diff --git a/nodebuilder/tests/p2p_test.go b/nodebuilder/tests/p2p_test.go index 2a973dda83..ff6e55b541 100644 --- a/nodebuilder/tests/p2p_test.go +++ b/nodebuilder/tests/p2p_test.go @@ -31,7 +31,7 @@ func TestUseBridgeNodeAsBootstraper(t *testing.T) { bridge := sw.NewBridgeNode() - ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute) + ctx, cancel := context.WithTimeout(context.Background(), defaultTimeout) t.Cleanup(cancel) err := bridge.Start(ctx) @@ -63,7 +63,7 @@ Steps: func TestAddPeerToBlackList(t *testing.T) { sw := swamp.NewSwamp(t) full := sw.NewFullNode() - ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute) + ctx, cancel := context.WithTimeout(context.Background(), defaultTimeout) t.Cleanup(cancel) require.NoError(t, full.Start(ctx)) @@ -97,7 +97,7 @@ func TestBootstrapNodesFromBridgeNode(t *testing.T) { bridge := sw.NewNodeWithConfig(node.Bridge, cfg) - ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute) + ctx, cancel := context.WithTimeout(context.Background(), defaultTimeout) t.Cleanup(cancel) err := bridge.Start(ctx) @@ -179,7 +179,7 @@ func TestRestartNodeDiscovery(t *testing.T) { cfg.Share.PeersLimit = fullNodes bridge := sw.NewNodeWithConfig(node.Bridge, cfg) - ctx, cancel := context.WithTimeout(context.Background(), 20*time.Second) + ctx, cancel := context.WithTimeout(context.Background(), defaultTimeout) t.Cleanup(cancel) err := bridge.Start(ctx) diff --git a/nodebuilder/tests/reconstruct_test.go b/nodebuilder/tests/reconstruct_test.go index 16016ba9bd..97b1639fa8 100644 --- a/nodebuilder/tests/reconstruct_test.go +++ b/nodebuilder/tests/reconstruct_test.go @@ -42,7 +42,7 @@ func TestFullReconstructFromBridge(t *testing.T) { btime = time.Millisecond * 300 ) - ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) + ctx, cancel := context.WithTimeout(context.Background(), defaultTimeout) t.Cleanup(cancel) sw := swamp.NewSwamp(t, swamp.WithBlockTime(btime)) fillDn := sw.FillBlocks(ctx, bsize, blocks) @@ -99,7 +99,8 @@ func TestFullReconstructFromLights(t *testing.T) { lnodes = 69 ) - ctx, cancel := context.WithTimeout(context.Background(), time.Minute*5) + ctx, cancel := context.WithTimeout(context.Background(), defaultTimeout) + t.Cleanup(cancel) sw := swamp.NewSwamp(t, swamp.WithBlockTime(btime)) fillDn := sw.FillBlocks(ctx, bsize, blocks) diff --git a/nodebuilder/tests/sync_test.go b/nodebuilder/tests/sync_test.go index d6f5a73928..591a56ce85 100644 --- a/nodebuilder/tests/sync_test.go +++ b/nodebuilder/tests/sync_test.go @@ -16,7 +16,7 @@ import ( ) // a default timeout for the context that is used in tests -const defaultTimeout = 40 * time.Second +const defaultTimeout = time.Minute * 5 /* Test-Case: Sync a Light Node with a Bridge Node @@ -83,7 +83,7 @@ func TestSyncStartStopLightWithBridge(t *testing.T) { bridge := sw.NewBridgeNode() - ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute) + ctx, cancel := context.WithTimeout(context.Background(), defaultTimeout) t.Cleanup(cancel) sw.WaitTillHeight(ctx, 50) @@ -138,7 +138,7 @@ func TestSyncFullWithBridge(t *testing.T) { bridge := sw.NewBridgeNode() - ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute) + ctx, cancel := context.WithTimeout(context.Background(), defaultTimeout) t.Cleanup(cancel) sw.WaitTillHeight(ctx, 20) @@ -186,7 +186,7 @@ func TestSyncLightWithFull(t *testing.T) { bridge := sw.NewBridgeNode() - ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute) + ctx, cancel := context.WithTimeout(context.Background(), defaultTimeout) t.Cleanup(cancel) sw.WaitTillHeight(ctx, 20) @@ -252,7 +252,7 @@ func TestSyncLightWithTrustedPeers(t *testing.T) { bridge := sw.NewBridgeNode() - ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute) + ctx, cancel := context.WithTimeout(context.Background(), defaultTimeout) t.Cleanup(cancel) sw.WaitTillHeight(ctx, 20)