Browse Source

e2e: adjust timeouts to be dynamic to size of network (#6202)

callum/e2e-timeout
Callum Waters 4 years ago
committed by GitHub
parent
commit
cab10db725
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 3 deletions
  1. +2
    -2
      test/e2e/runner/rpc.go
  2. +7
    -1
      test/e2e/runner/wait.go

+ 2
- 2
test/e2e/runner/rpc.go View File

@ -86,7 +86,7 @@ func waitForNode(node *e2e.Node, height int64, timeout time.Duration) (*rpctypes
return status, nil
}
time.Sleep(200 * time.Millisecond)
time.Sleep(300 * time.Millisecond)
}
}
@ -97,7 +97,7 @@ func waitForAllNodes(testnet *e2e.Testnet, height int64, timeout time.Duration)
if node.Mode == e2e.ModeSeed {
continue
}
status, err := waitForNode(node, height, 20*time.Second)
status, err := waitForNode(node, height, timeout)
if err != nil {
return 0, err
}


+ 7
- 1
test/e2e/runner/wait.go View File

@ -20,9 +20,15 @@ func Wait(testnet *e2e.Testnet, blocks int64) error {
// WaitUntil waits until a given height has been reached.
func WaitUntil(testnet *e2e.Testnet, height int64) error {
logger.Info(fmt.Sprintf("Waiting for all nodes to reach height %v...", height))
_, err := waitForAllNodes(testnet, height, 20*time.Second)
_, err := waitForAllNodes(testnet, height, waitingTime(len(testnet.Nodes)))
if err != nil {
return err
}
return nil
}
// waitingTime estimates how long it should take for a node to reach the height.
// More nodes in a network implies we may expect a slower network and may have to wait longer.
func waitingTime(nodes int) time.Duration {
return time.Duration(20+(nodes*2)) * time.Second
}

Loading…
Cancel
Save