diff options
Diffstat (limited to 'cmd/swarm/swarm-smoke/upload_and_sync.go')
-rw-r--r-- | cmd/swarm/swarm-smoke/upload_and_sync.go | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/cmd/swarm/swarm-smoke/upload_and_sync.go b/cmd/swarm/swarm-smoke/upload_and_sync.go index d5300b63d..5e0ff4b0f 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 generateEndpoints(scheme string, cluster string, from int, to int) { if cluster == "prod" { cluster = "" + } else if cluster == "local" { + for port := from; port <= to; port++ { + endpoints = append(endpoints, fmt.Sprintf("%s://localhost:%v", scheme, port)) + } + return } else { cluster = cluster + "." } @@ -53,13 +58,13 @@ func generateEndpoints(scheme string, cluster string, from int, to int) { } func cliUploadAndSync(c *cli.Context) error { - defer func(now time.Time) { log.Info("total time", "time", time.Since(now), "size", filesize) }(time.Now()) + defer func(now time.Time) { log.Info("total time", "time", time.Since(now), "size (kb)", filesize) }(time.Now()) generateEndpoints(scheme, cluster, from, to) log.Info("uploading to " + endpoints[0] + " and syncing") - f, cleanup := generateRandomFile(filesize * 1000000) + f, cleanup := generateRandomFile(filesize * 1000) defer cleanup() hash, err := upload(f, endpoints[0]) @@ -76,12 +81,7 @@ func cliUploadAndSync(c *cli.Context) error { log.Info("uploaded successfully", "hash", hash, "digest", fmt.Sprintf("%x", fhash)) - if filesize < 10 { - time.Sleep(35 * time.Second) - } else { - time.Sleep(15 * time.Second) - time.Sleep(2 * time.Duration(filesize) * time.Second) - } + time.Sleep(3 * time.Second) wg := sync.WaitGroup{} for _, endpoint := range endpoints { @@ -109,7 +109,7 @@ func cliUploadAndSync(c *cli.Context) error { // fetch is getting the requested `hash` from the `endpoint` and compares it with the `original` file func fetch(hash string, endpoint string, original []byte, ruid string) error { log.Trace("sleeping", "ruid", ruid) - time.Sleep(5 * time.Second) + time.Sleep(3 * time.Second) log.Trace("http get request", "ruid", ruid, "api", endpoint, "hash", hash) res, err := http.Get(endpoint + "/bzz:/" + hash + "/") |