mirror of
https://github.com/tendermint/tendermint.git
synced 2026-02-08 04:50:16 +00:00
Partial fix for #5291. For details, see [README.md](https://github.com/tendermint/tendermint/blob/erik/e2e-tests/test/e2e/README.md) and [RFC-001](https://github.com/tendermint/tendermint/blob/master/docs/rfc/rfc-001-end-to-end-testing.md). This only includes a single test case under `test/e2e/tests/`, as a proof of concept - additional test cases will be submitted separately. A randomized testnet generator will also be submitted separately, there a currently just a handful of static testnets under `test/e2e/networks/`. This will eventually replace the current P2P tests and run in CI.
25 lines
544 B
Go
25 lines
544 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"time"
|
|
|
|
e2e "github.com/tendermint/tendermint/test/e2e/pkg"
|
|
)
|
|
|
|
// Wait waits for a number of blocks to be produced, and for all nodes to catch
|
|
// up with it.
|
|
func Wait(testnet *e2e.Testnet, blocks int64) error {
|
|
block, _, err := waitForHeight(testnet, 0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
waitFor := block.Height + blocks
|
|
logger.Info(fmt.Sprintf("Waiting for all nodes to reach height %v...", waitFor))
|
|
_, err = waitForAllNodes(testnet, waitFor, 20*time.Second)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|