diff --git a/.changelog/unreleased/improvements/2094-e2e-load-max-txs.md b/.changelog/unreleased/improvements/2094-e2e-load-max-txs.md new file mode 100644 index 00000000000..31ca79cfe3b --- /dev/null +++ b/.changelog/unreleased/improvements/2094-e2e-load-max-txs.md @@ -0,0 +1,2 @@ +- `[e2e]` Add manifest option `load_max_txs` to limit the number of transactions generated by the + `load` command. ([\#2094](https://github.com/cometbft/cometbft/pull/2094)) diff --git a/test/e2e/pkg/manifest.go b/test/e2e/pkg/manifest.go index 84dd4a286d0..74642cab235 100644 --- a/test/e2e/pkg/manifest.go +++ b/test/e2e/pkg/manifest.go @@ -86,6 +86,7 @@ type Manifest struct { LoadTxSizeBytes int `toml:"load_tx_size_bytes"` LoadTxBatchSize int `toml:"load_tx_batch_size"` LoadTxConnections int `toml:"load_tx_connections"` + LoadMaxTxs int `toml:"load_max_txs"` // Enable or disable Prometheus metrics on all nodes. // Defaults to false (disabled). diff --git a/test/e2e/pkg/testnet.go b/test/e2e/pkg/testnet.go index 5d641e3b674..b1aad111bdb 100644 --- a/test/e2e/pkg/testnet.go +++ b/test/e2e/pkg/testnet.go @@ -86,6 +86,7 @@ type Testnet struct { LoadTxSizeBytes int LoadTxBatchSize int LoadTxConnections int + LoadMaxTxs int ABCIProtocol string PrepareProposalDelay time.Duration ProcessProposalDelay time.Duration @@ -175,6 +176,7 @@ func NewTestnetFromManifest(manifest Manifest, file string, ifd InfrastructureDa LoadTxSizeBytes: manifest.LoadTxSizeBytes, LoadTxBatchSize: manifest.LoadTxBatchSize, LoadTxConnections: manifest.LoadTxConnections, + LoadMaxTxs: manifest.LoadMaxTxs, ABCIProtocol: manifest.ABCIProtocol, PrepareProposalDelay: manifest.PrepareProposalDelay, ProcessProposalDelay: manifest.ProcessProposalDelay, diff --git a/test/e2e/runner/load.go b/test/e2e/runner/load.go index 2dd630f2e7d..4c047a32133 100644 --- a/test/e2e/runner/load.go +++ b/test/e2e/runner/load.go @@ -51,6 +51,11 @@ func Load(ctx context.Context, testnet *e2e.Testnet) error { select { case <-chSuccess: success++ + if testnet.LoadMaxTxs > 0 && success >= testnet.LoadMaxTxs { + logger.Info("load", "msg", log.NewLazySprintf("Ending transaction load after reaching %v txs (%.1f tx/s)...", + success, float64(success)/time.Since(started).Seconds())) + return nil + } timeout = stallTimeout case <-time.After(timeout): return fmt.Errorf("unable to submit transactions for %v", timeout)