Unverified Commit 3d067b0c authored by Anton Evangelatov's avatar Anton Evangelatov Committed by GitHub

cmd/swarm/swarm-smoke: do not fail if a node does not respond to rpc (#19280)

parent f1809812
...@@ -44,7 +44,7 @@ func uploadAndSyncCmd(ctx *cli.Context, tuid string) error { ...@@ -44,7 +44,7 @@ func uploadAndSyncCmd(ctx *cli.Context, tuid string) error {
errc := make(chan error) errc := make(chan error)
go func() { go func() {
errc <- uplaodAndSync(ctx, randomBytes, tuid) errc <- uploadAndSync(ctx, randomBytes, tuid)
}() }()
select { select {
...@@ -65,6 +65,14 @@ func uploadAndSyncCmd(ctx *cli.Context, tuid string) error { ...@@ -65,6 +65,14 @@ func uploadAndSyncCmd(ctx *cli.Context, tuid string) error {
return e 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 { func trackChunks(testData []byte) error {
...@@ -87,14 +95,14 @@ func trackChunks(testData []byte) error { ...@@ -87,14 +95,14 @@ func trackChunks(testData []byte) error {
rpcClient, err := rpc.Dial(httpHost) rpcClient, err := rpc.Dial(httpHost)
if err != nil { if err != nil {
log.Error("Error dialing host", "err", err) log.Error("Error dialing host", "err", err)
return err continue
} }
var hasInfo []api.HasInfo var hasInfo []api.HasInfo
err = rpcClient.Call(&hasInfo, "bzz_has", addrs) err = rpcClient.Call(&hasInfo, "bzz_has", addrs)
if err != nil { if err != nil {
log.Error("Error calling host", "err", err) log.Error("Error calling host", "err", err)
return err continue
} }
count := 0 count := 0
...@@ -134,7 +142,7 @@ func getAllRefs(testData []byte) (storage.AddressCollection, error) { ...@@ -134,7 +142,7 @@ func getAllRefs(testData []byte) (storage.AddressCollection, error) {
return fileStore.GetAllReferences(ctx, reader, false) 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) log.Info("uploading to "+httpEndpoint(hosts[0])+" and syncing", "tuid", tuid, "seed", seed)
t1 := time.Now() t1 := time.Now()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment