Browse Source

adjust tx load (#6681)

pull/6682/head
Callum Waters 4 years ago
committed by GitHub
parent
commit
9d9360774f
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 8 deletions
  1. +4
    -3
      test/e2e/runner/load.go
  2. +2
    -5
      test/e2e/runner/main.go

+ 4
- 3
test/e2e/runner/load.go View File

@ -68,9 +68,9 @@ func Load(ctx context.Context, testnet *e2e.Testnet, multiplier int) error {
// loadGenerate generates jobs until the context is canceled
func loadGenerate(ctx context.Context, chTx chan<- types.Tx, multiplier int, size int64) {
for i := 0; i < math.MaxInt64; i++ {
// We keep generating the same 1000 keys over and over, with different values.
// We keep generating the same 100 keys over and over, with different values.
// This gives a reasonable load without putting too much data in the app.
id := i % 1000
id := i % 100
bz := make([]byte, size)
_, err := rand.Read(bz)
@ -81,7 +81,8 @@ func loadGenerate(ctx context.Context, chTx chan<- types.Tx, multiplier int, siz
select {
case chTx <- tx:
time.Sleep(time.Millisecond * time.Duration(int(size)/multiplier))
sqrtSize := int(math.Sqrt(float64(size)))
time.Sleep(10 * time.Millisecond * time.Duration(sqrtSize/multiplier))
case <-ctx.Done():
close(chTx)


+ 2
- 5
test/e2e/runner/main.go View File

@ -61,9 +61,6 @@ func NewCLI() *CLI {
defer loadCancel()
go func() {
err := Load(ctx, cli.testnet, 1)
if err != nil {
logger.Error(fmt.Sprintf("Transaction load failed: %v", err.Error()))
}
chLoadResult <- err
}()
@ -95,9 +92,9 @@ func NewCLI() *CLI {
loadCancel()
if err := <-chLoadResult; err != nil {
return err
return fmt.Errorf("transaction load failed: %w", err)
}
if err := Wait(cli.testnet, 8); err != nil { // wait for network to settle before tests
if err := Wait(cli.testnet, 5); err != nil { // wait for network to settle before tests
return err
}
if err := Test(cli.testnet); err != nil {


Loading…
Cancel
Save