cmd/swarm/swarm-smoke-pss: flag for msg size

This commit is contained in:
Rafael Matias 2019-03-26 11:44:10 +01:00
parent 2052f31397
commit 455bef94b9
No known key found for this signature in database
GPG key ID: 1BC39532FB4A2DBD
2 changed files with 11 additions and 2 deletions

View file

@ -19,6 +19,7 @@ package main
import (
"os"
"sort"
"strconv"
"github.com/ethereum/go-ethereum/cmd/utils"
gethmetrics "github.com/ethereum/go-ethereum/metrics"
@ -44,6 +45,7 @@ var (
verbosity int
timeout int
pssMessageCount int
pssMessageSize int
)
func main() {
@ -84,11 +86,17 @@ func main() {
Destination: &timeout,
},
cli.IntFlag{
Name: "pss-messages",
Name: "msgcount",
Value: 10,
Usage: "number of pss messages that should be send in the pss smoke test",
Destination: &pssMessageCount,
},
cli.IntFlag{
Name: "msgbytes",
Value: 128,
Usage: "size of a randomly generated message. defined in bytes",
Destination: &pssMessageSize,
},
}
app.Flags = append(app.Flags, []cli.Flag{
@ -154,6 +162,7 @@ func emitMetrics(ctx *cli.Context) error {
tagsMap := utils.SplitTagsFlag(tags)
tagsMap["version"] = gitCommit
tagsMap["msgbytes"] = strconv.Itoa(pssMessageSize)
return influxdb.InfluxDBWithTagsOnce(gethmetrics.DefaultRegistry, endpoint, database, username, password, "swarm-smoke-pss.", tagsMap)
}

View file

@ -247,7 +247,7 @@ func (s *pssSession) genJob(mode pssMode) pssJob {
log.Trace("recv node", "pss_baseAddr", hexutil.Encode(recvNode.addr), "host", hosts[recvNodeIdx])
// create new message and add it to job index to check for receives
randomMsg := testutil.RandomBytes(seed, 128)
randomMsg := testutil.RandomBytes(seed, pssMessageSize)
// change seed so that the next random message is different
seed = seed + 1