swarm-smoke: add debug flag (#1428)
This commit is contained in:
@ -48,6 +48,7 @@ var (
|
||||
timeout int
|
||||
single bool
|
||||
onlyUpload bool
|
||||
debug bool
|
||||
)
|
||||
|
||||
func main() {
|
||||
@ -114,6 +115,11 @@ func main() {
|
||||
Usage: "whether to only upload content to a single node without fetching",
|
||||
Destination: &onlyUpload,
|
||||
},
|
||||
cli.BoolFlag{
|
||||
Name: "debug",
|
||||
Usage: "whether to call debug APIs as part of the smoke test",
|
||||
Destination: &debug,
|
||||
},
|
||||
}
|
||||
|
||||
app.Flags = append(app.Flags, []cli.Flag{
|
||||
|
@ -65,10 +65,12 @@ func uploadAndSyncCmd(ctx *cli.Context) error {
|
||||
err = fmt.Errorf("timeout after %v sec", timeout)
|
||||
}
|
||||
|
||||
// trigger debug functionality on randomBytes
|
||||
e := trackChunks(randomBytes[:], true)
|
||||
if e != nil {
|
||||
log.Error(e.Error())
|
||||
if debug {
|
||||
// trigger debug functionality on randomBytes
|
||||
e := trackChunks(randomBytes[:], true)
|
||||
if e != nil {
|
||||
log.Error(e.Error())
|
||||
}
|
||||
}
|
||||
|
||||
return err
|
||||
@ -291,9 +293,11 @@ func uploadAndSync(c *cli.Context, randomBytes []byte) error {
|
||||
|
||||
log.Debug("chunks before fetch attempt", "hash", hash)
|
||||
|
||||
err = trackChunks(randomBytes, false)
|
||||
if err != nil {
|
||||
log.Error(err.Error())
|
||||
if debug {
|
||||
err = trackChunks(randomBytes, false)
|
||||
if err != nil {
|
||||
log.Error(err.Error())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user