Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion pkg/bee/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ type Topology struct {
Population int
NnLowWatermark int
Depth int
Bins map[string]Bin
Bins BinMap
LightNodes Bin
Reachability string `json:"reachability"` // current reachability status
NetworkAvailability string `json:"networkAvailability"` // network availability
Expand All @@ -748,6 +748,28 @@ type Bin struct {
ConnectedPeers []api.PeerInfo `json:"connectedPeers"`
}

type BinMap map[string]Bin

// String returns a JSON summary of connected and disconnected peer counts per bin.
func (b BinMap) String() string {
type binSummary struct {
Connected int `json:"connected"`
Disconnected int `json:"disconnected"`
}
summary := make(map[string]binSummary, len(b))
for k, bin := range b {
summary[k] = binSummary{
Connected: bin.Connected,
Disconnected: len(bin.DisconnectedPeers),
}
}
data, err := json.Marshal(summary)
if err != nil {
return fmt.Sprintf("error: %v", err)
}
return string(data)
}

// Topology returns Kademlia topology
func (c *Client) Topology(ctx context.Context) (topology Topology, err error) {
var t api.Topology
Expand Down
18 changes: 16 additions & 2 deletions pkg/check/smoke/smoke.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,9 @@ func (c *Check) run(ctx context.Context, cluster orchestration.Cluster, o Option
time.Sleep(o.NodesSyncWait)

var (
rxCtx context.Context
rxCancel context.CancelFunc = func() {}
rxCtx context.Context
rxCancel context.CancelFunc = func() {}
downloaded bool
)

for range 3 {
Expand Down Expand Up @@ -236,6 +237,7 @@ func (c *Check) run(ctx context.Context, cluster orchestration.Cluster, o Option
downloadThroughput := float64(contentSize) / rxDuration.Seconds()
c.metrics.DownloadThroughput.WithLabelValues(sizeLabel, downloader.Name()).Set(downloadThroughput)
}
downloaded = true
break
}

Expand All @@ -258,6 +260,18 @@ func (c *Check) run(ctx context.Context, cluster orchestration.Cluster, o Option
c.logger.Infof("data mismatch for size %d: found %d different bytes, ~%.2f%%", contentSize, diff, float64(diff)/float64(txLen)*100)
}
rxCancel()

if !downloaded {
c.logger.Errorf("all download attempts failed for size %d, fetching downloader topology", contentSize)
top, topErr := downloader.Topology(ctx)
if topErr != nil {
c.logger.Errorf("failed to get downloader topology: %v", topErr)
} else {
c.logger.Infof("downloader %s topology: depth=%d, connected=%d, population=%d, reachability=%s, bins=%s",
downloader.Name(), top.Depth, top.Connected, top.Population, top.Reachability, top.Bins.String())
}
}

c.logger.Infof("completed testing file size: %d bytes", contentSize)
}

Expand Down