cmd/swarm/swarm-smoke: rename funcs to prefixCmd

This commit is contained in:
Anton Evangelatov 2019-02-07 12:42:30 +01:00
parent 39d66957d3
commit 5f17a46a72
5 changed files with 16 additions and 16 deletions

View file

@ -26,11 +26,11 @@ const (
feedRandomDataLength = 8
)
func feedUploadAndSync(ctx *cli.Context, tuid string) error {
func feedUploadAndSyncCmd(ctx *cli.Context, tuid string) error {
errc := make(chan error)
go func() {
errc <- fuas(ctx, tuid)
errc <- feedUploadAndSync(ctx, tuid)
}()
select {
@ -46,7 +46,7 @@ func feedUploadAndSync(ctx *cli.Context, tuid string) error {
}
}
func fuas(c *cli.Context, tuid string) error {
func feedUploadAndSync(c *cli.Context, tuid string) error {
log.Info("generating and uploading feeds to " + httpEndpoint(hosts[0]) + " and syncing")
// create a random private key to sign updates with and derive the address

View file

@ -120,25 +120,25 @@ func main() {
Name: "upload_and_sync",
Aliases: []string{"c"},
Usage: "upload and sync",
Action: wrapCliCommand("upload-and-sync", uploadAndSync),
Action: wrapCliCommand("upload-and-sync", uploadAndSyncCmd),
},
{
Name: "feed_sync",
Aliases: []string{"f"},
Usage: "feed update generate, upload and sync",
Action: wrapCliCommand("feed-and-sync", feedUploadAndSync),
Action: wrapCliCommand("feed-and-sync", feedUploadAndSyncCmd),
},
{
Name: "upload_speed",
Aliases: []string{"u"},
Usage: "measure upload speed",
Action: wrapCliCommand("upload-speed", uploadSpeed),
Action: wrapCliCommand("upload-speed", uploadSpeedCmd),
},
{
Name: "sliding_window",
Aliases: []string{"s"},
Usage: "measure network aggregate capacity",
Action: wrapCliCommand("sliding-window", slidingWindow),
Action: wrapCliCommand("sliding-window", slidingWindowCmd),
},
}

View file

@ -35,11 +35,11 @@ type uploadResult struct {
digest []byte
}
func slidingWindow(ctx *cli.Context, tuid string) error {
func slidingWindowCmd(ctx *cli.Context, tuid string) error {
errc := make(chan error)
go func() {
errc <- sl(ctx, tuid)
errc <- slidingWindow(ctx, tuid)
}()
select {
@ -55,7 +55,7 @@ func slidingWindow(ctx *cli.Context, tuid string) error {
}
}
func sl(ctx *cli.Context, tuid string) error {
func slidingWindow(ctx *cli.Context, tuid string) error {
hashes := []uploadResult{} //swarm hashes of the uploads
nodes := len(hosts)
const iterationTimeout = 30 * time.Second

View file

@ -31,13 +31,13 @@ import (
cli "gopkg.in/urfave/cli.v1"
)
func uploadAndSync(ctx *cli.Context, tuid string) error {
func uploadAndSyncCmd(ctx *cli.Context, tuid string) error {
randomBytes := testutil.RandomBytes(seed, filesize*1000)
errc := make(chan error)
go func() {
errc <- uas(ctx, randomBytes, tuid)
errc <- uplaodAndSync(ctx, randomBytes, tuid)
}()
select {
@ -55,7 +55,7 @@ func uploadAndSync(ctx *cli.Context, tuid string) error {
}
}
func uas(c *cli.Context, randomBytes []byte, tuid string) error {
func uplaodAndSync(c *cli.Context, randomBytes []byte, tuid string) error {
log.Info("uploading to "+httpEndpoint(hosts[0])+" and syncing", "tuid", tuid, "seed", seed)
t1 := time.Now()

View file

@ -28,14 +28,14 @@ import (
cli "gopkg.in/urfave/cli.v1"
)
func uploadSpeed(ctx *cli.Context, tuid string) error {
func uploadSpeedCmd(ctx *cli.Context, tuid string) error {
log.Info("uploading to "+hosts[0], "tuid", tuid, "seed", seed)
randomBytes := testutil.RandomBytes(seed, filesize*1000)
errc := make(chan error)
go func() {
errc <- us(ctx, tuid, randomBytes)
errc <- uploadSpeed(ctx, tuid, randomBytes)
}()
select {
@ -53,7 +53,7 @@ func uploadSpeed(ctx *cli.Context, tuid string) error {
}
}
func us(c *cli.Context, tuid string, data []byte) error {
func uploadSpeed(c *cli.Context, tuid string, data []byte) error {
t1 := time.Now()
hash, err := upload(data, hosts[0])
if err != nil {