Skip to content

Commit

Permalink
tests(node): increase test timeouts to 5 min
Browse files Browse the repository at this point in the history
It's very likely that introduction of new App into Swamp brings more CPU usage subsequently increasing the time CI needs to finish tests
  • Loading branch information
Wondertan committed Oct 11, 2022
1 parent 6249a18 commit 0467a3a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
4 changes: 2 additions & 2 deletions nodebuilder/tests/fraud_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions nodebuilder/tests/p2p_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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))

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
5 changes: 3 additions & 2 deletions nodebuilder/tests/reconstruct_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
10 changes: 5 additions & 5 deletions nodebuilder/tests/sync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 0467a3a

Please sign in to comment.