perf net: Show the error with the bandwidth results (#4688)

An error in the result does not mean that the whole perf net test
failed, we can still show some results, with an error as well, to be
less confusing to the user.
This commit is contained in:
Anis Eleuch
2023-09-20 08:22:31 -07:00
committed by GitHub
parent 79df949087
commit 97f142099b
+6 -15
View File
@@ -212,21 +212,12 @@ func (m *speedTestUI) View() string {
})
} else {
for _, nodeResult := range nres.NodeResults {
if nodeResult.Error != "" {
data = append(data, []string{
trailerIfGreaterThan(nodeResult.Endpoint, 64),
crossTickCell,
crossTickCell,
"Err: " + nodeResult.Error,
})
} else {
data = append(data, []string{
trailerIfGreaterThan(nodeResult.Endpoint, 64),
whiteStyle.Render(humanize.IBytes(uint64(nodeResult.RX))) + "/s",
whiteStyle.Render(humanize.IBytes(uint64(nodeResult.TX))) + "/s",
"",
})
}
data = append(data, []string{
trailerIfGreaterThan(nodeResult.Endpoint, 64),
whiteStyle.Render(humanize.IBytes(uint64(nodeResult.RX))) + "/s",
whiteStyle.Render(humanize.IBytes(uint64(nodeResult.TX))) + "/s",
"Err: " + nodeResult.Error,
})
}
}