add input seed

This commit is contained in:
Anton Evangelatov 2019-03-18 12:42:31 +01:00
parent a22e56974f
commit d972357ca1
2 changed files with 12 additions and 0 deletions

View file

@ -40,6 +40,7 @@ var (
allhosts string allhosts string
hosts []string hosts []string
filesize int filesize int
inputSeed int
syncDelay int syncDelay int
httpPort int httpPort int
wsPort int wsPort int
@ -74,6 +75,12 @@ func main() {
Usage: "ws port", Usage: "ws port",
Destination: &wsPort, Destination: &wsPort,
}, },
cli.IntFlag{
Name: "seed",
Value: 0,
Usage: "input seed in case we need deterministic upload",
Destination: &inputSeed,
},
cli.IntFlag{ cli.IntFlag{
Name: "filesize", Name: "filesize",
Value: 1024, Value: 1024,

View file

@ -39,6 +39,11 @@ import (
) )
func uploadAndSyncCmd(ctx *cli.Context, tuid string) error { 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) randomBytes := testutil.RandomBytes(seed, filesize*1000)
errc := make(chan error) errc := make(chan error)