diff options
author | Anton Evangelatov <anton.evangelatov@gmail.com> | 2019-03-08 15:52:05 +0800 |
---|---|---|
committer | Viktor TrĂ³n <viktor.tron@gmail.com> | 2019-03-08 15:52:05 +0800 |
commit | ceeb047e6958df32b5dacf0ce29e51c0314f905a (patch) | |
tree | 02014cfc1827c774b76341bb6c4edcbb9e601254 | |
parent | a6e5c6a2cc020fe50649b23f854d03d8f5fadcc1 (diff) | |
download | go-tangerine-ceeb047e6958df32b5dacf0ce29e51c0314f905a.tar go-tangerine-ceeb047e6958df32b5dacf0ce29e51c0314f905a.tar.gz go-tangerine-ceeb047e6958df32b5dacf0ce29e51c0314f905a.tar.bz2 go-tangerine-ceeb047e6958df32b5dacf0ce29e51c0314f905a.tar.lz go-tangerine-ceeb047e6958df32b5dacf0ce29e51c0314f905a.tar.xz go-tangerine-ceeb047e6958df32b5dacf0ce29e51c0314f905a.tar.zst go-tangerine-ceeb047e6958df32b5dacf0ce29e51c0314f905a.zip |
cmd/swarm/swarm-smoke: better logs when debug mode triggers (#19237)
* cmd/swarm/swarm-smoke: better logs for debug functionality;
* cmd/swarm/swarm-smoke: fixup
-rw-r--r-- | cmd/swarm/swarm-smoke/upload_and_sync.go | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/cmd/swarm/swarm-smoke/upload_and_sync.go b/cmd/swarm/swarm-smoke/upload_and_sync.go index 90230df25..50af122e7 100644 --- a/cmd/swarm/swarm-smoke/upload_and_sync.go +++ b/cmd/swarm/swarm-smoke/upload_and_sync.go @@ -23,6 +23,7 @@ import ( "io/ioutil" "math/rand" "os" + "strings" "sync" "time" @@ -75,10 +76,17 @@ func trackChunks(testData []byte) error { } log.Trace("All references retrieved") + for i, ref := range addrs { + log.Trace(fmt.Sprintf("ref %d", i), "ref", ref) + } + // has-chunks for _, host := range hosts { httpHost := fmt.Sprintf("ws://%s:%d", host, 8546) log.Trace("Calling `Has` on host", "httpHost", httpHost) + + hostChunks := []string{} + rpcClient, err := rpc.Dial(httpHost) if err != nil { log.Trace("Error dialing host", "err", err) @@ -93,15 +101,27 @@ func trackChunks(testData []byte) error { } log.Trace("rpc call ok") count := 0 - for _, info := range hasInfo { - if !info.Has { + for i, info := range hasInfo { + if i == 0 { + log.Trace("first hasInfo", "addr", info.Addr, "host", host, "i", i) + } + if i == len(hasInfo)-1 { + log.Trace("last hasInfo", "addr", info.Addr, "host", host, "i", i) + } + + if info.Has { + hostChunks = append(hostChunks, "1") + } else { + hostChunks = append(hostChunks, "0") count++ - log.Error("Host does not have chunk", "host", httpHost, "chunk", info.Addr) } + } if count == 0 { - log.Info("Host reported to have all chunks", "host", httpHost) + log.Info("host reported to have all chunks", "host", host) } + + log.Trace("chunks", "chunks", strings.Join(hostChunks, ""), "host", host) } return nil } |