From d972357ca15f6ebb4b76e894665414867de9ed0a Mon Sep 17 00:00:00 2001 From: Anton Evangelatov Date: Mon, 18 Mar 2019 12:42:31 +0100 Subject: [PATCH] add input seed --- cmd/swarm/swarm-smoke/main.go | 7 +++++++ cmd/swarm/swarm-smoke/upload_and_sync.go | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/cmd/swarm/swarm-smoke/main.go b/cmd/swarm/swarm-smoke/main.go index 43d2c1ff51df..860fbcc1dd10 100644 --- a/cmd/swarm/swarm-smoke/main.go +++ b/cmd/swarm/swarm-smoke/main.go @@ -40,6 +40,7 @@ var ( allhosts string hosts []string filesize int + inputSeed int syncDelay int httpPort int wsPort int @@ -74,6 +75,12 @@ func main() { Usage: "ws port", Destination: &wsPort, }, + cli.IntFlag{ + Name: "seed", + Value: 0, + Usage: "input seed in case we need deterministic upload", + Destination: &inputSeed, + }, cli.IntFlag{ Name: "filesize", Value: 1024, diff --git a/cmd/swarm/swarm-smoke/upload_and_sync.go b/cmd/swarm/swarm-smoke/upload_and_sync.go index a3fa10feddf8..515b46996652 100644 --- a/cmd/swarm/swarm-smoke/upload_and_sync.go +++ b/cmd/swarm/swarm-smoke/upload_and_sync.go @@ -39,6 +39,11 @@ import ( ) func uploadAndSyncCmd(ctx *cli.Context, tuid string) error { + // use input seed if it has been set + if inputSeed != 0 { + seed = inputSeed + } + randomBytes := testutil.RandomBytes(seed, filesize*1000) errc := make(chan error)