From 3d067b0ceab52deaa4862189af643130ad3e4def Mon Sep 17 00:00:00 2001 From: Anton Evangelatov Date: Fri, 15 Mar 2019 17:36:39 +0100 Subject: [PATCH] cmd/swarm/swarm-smoke: do not fail if a node does not respond to rpc (#19280) --- cmd/swarm/swarm-smoke/upload_and_sync.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/cmd/swarm/swarm-smoke/upload_and_sync.go b/cmd/swarm/swarm-smoke/upload_and_sync.go index 23b7d5688..d1032f821 100644 --- a/cmd/swarm/swarm-smoke/upload_and_sync.go +++ b/cmd/swarm/swarm-smoke/upload_and_sync.go @@ -44,7 +44,7 @@ func uploadAndSyncCmd(ctx *cli.Context, tuid string) error { errc := make(chan error) go func() { - errc <- uplaodAndSync(ctx, randomBytes, tuid) + errc <- uploadAndSync(ctx, randomBytes, tuid) }() select { @@ -65,6 +65,14 @@ func uploadAndSyncCmd(ctx *cli.Context, tuid string) error { return e } + + // trigger debug functionality on randomBytes even on successful runs + err := trackChunks(randomBytes[:]) + if err != nil { + log.Error(err.Error()) + } + + return nil } func trackChunks(testData []byte) error { @@ -87,14 +95,14 @@ func trackChunks(testData []byte) error { rpcClient, err := rpc.Dial(httpHost) if err != nil { log.Error("Error dialing host", "err", err) - return err + continue } var hasInfo []api.HasInfo err = rpcClient.Call(&hasInfo, "bzz_has", addrs) if err != nil { log.Error("Error calling host", "err", err) - return err + continue } count := 0 @@ -134,7 +142,7 @@ func getAllRefs(testData []byte) (storage.AddressCollection, error) { return fileStore.GetAllReferences(ctx, reader, false) } -func uplaodAndSync(c *cli.Context, randomBytes []byte, tuid string) error { +func uploadAndSync(c *cli.Context, randomBytes []byte, tuid string) error { log.Info("uploading to "+httpEndpoint(hosts[0])+" and syncing", "tuid", tuid, "seed", seed) t1 := time.Now()