mirror of
https://github.com/tendermint/tendermint.git
synced 2026-04-23 01:00:31 +00:00
e2e: tighten timing for load generation (#6990)
This commit is contained in:
4
.github/workflows/e2e-nightly-master.yml
vendored
4
.github/workflows/e2e-nightly-master.yml
vendored
@@ -17,7 +17,7 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
p2p: ['legacy', 'new', 'hybrid']
|
||||
group: ['00', '01']
|
||||
group: ['00', '01', '02', '03']
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 60
|
||||
steps:
|
||||
@@ -35,7 +35,7 @@ jobs:
|
||||
- name: Generate testnets
|
||||
working-directory: test/e2e
|
||||
# When changing -g, also change the matrix groups above
|
||||
run: ./build/generator -g 2 -d networks/nightly/${{ matrix.p2p }} -p ${{ matrix.p2p }}
|
||||
run: ./build/generator -g 4 -d networks/nightly/${{ matrix.p2p }} -p ${{ matrix.p2p }}
|
||||
|
||||
- name: Run ${{ matrix.p2p }} p2p testnets in group ${{ matrix.group }}
|
||||
working-directory: test/e2e
|
||||
|
||||
@@ -3,7 +3,6 @@ package main
|
||||
import (
|
||||
"container/ring"
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"time"
|
||||
@@ -58,19 +57,9 @@ func Load(ctx context.Context, testnet *e2e.Testnet) error {
|
||||
case numSeen := <-chSuccess:
|
||||
success += numSeen
|
||||
case <-ctx.Done():
|
||||
// if we couldn't submit any transactions,
|
||||
// that's probably a problem and the test
|
||||
// should error; however, for very short tests
|
||||
// we shouldn't abort.
|
||||
//
|
||||
// The 2s cut off, is a rough guess based on
|
||||
// the expected value of
|
||||
// loadGenerateWaitTime. If the implementation
|
||||
// of that function changes, then this might
|
||||
// also need to change without more
|
||||
// refactoring.
|
||||
if success == 0 && time.Since(started) > 2*time.Second {
|
||||
return errors.New("failed to submit any transactions")
|
||||
if success == 0 {
|
||||
return fmt.Errorf("failed to submit transactions in %s by %d workers",
|
||||
time.Since(started), concurrency)
|
||||
}
|
||||
|
||||
// TODO perhaps allow test networks to
|
||||
@@ -141,9 +130,14 @@ func loadGenerateWaitTime(size int64) time.Duration {
|
||||
baseJitter = rand.Int63n(max-min+1) + min // nolint: gosec
|
||||
sizeFactor = size * int64(time.Millisecond)
|
||||
sizeJitter = rand.Int63n(sizeFactor-min+1) + min // nolint: gosec
|
||||
waitTime = time.Duration(baseJitter + sizeJitter)
|
||||
)
|
||||
|
||||
return time.Duration(baseJitter + sizeJitter)
|
||||
if size == 1 {
|
||||
return waitTime / 2
|
||||
}
|
||||
|
||||
return waitTime
|
||||
}
|
||||
|
||||
// loadProcess processes transactions
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
@@ -75,7 +76,7 @@ func NewCLI() *CLI {
|
||||
go func() {
|
||||
chLoadResult <- Load(lctx, cli.testnet)
|
||||
}()
|
||||
|
||||
startAt := time.Now()
|
||||
if err = Start(ctx, cli.testnet); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -102,6 +103,19 @@ func NewCLI() *CLI {
|
||||
}
|
||||
}
|
||||
|
||||
// to help make sure that we don't run into
|
||||
// situations where 0 transactions have
|
||||
// happened on quick cases, we make sure that
|
||||
// it's been at least 10s before canceling the
|
||||
// load generator.
|
||||
//
|
||||
// TODO allow the load generator to report
|
||||
// successful transactions to avoid needing
|
||||
// this sleep.
|
||||
if rest := time.Since(startAt); rest < 15*time.Second {
|
||||
time.Sleep(15*time.Second - rest)
|
||||
}
|
||||
|
||||
loadCancel()
|
||||
|
||||
if err = <-chLoadResult; err != nil {
|
||||
|
||||
Reference in New Issue
Block a user