Skip to content

Commit 480c277

Browse files
committed
roachtest: handle no ts datapoints in rebalance by-load roachtests
The `rebalance/by-load` roachtests collect timeseries data from the cluster. If these tests started quickly enough, no datapoints could exist which would cause an out of bounds array error. Handle the no datapoints case, and log a message without failing the test. Informs: cockroachdb#107247 Release note: None
1 parent 1d3c11e commit 480c277

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

pkg/cmd/roachtest/tests/rebalance_load.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,11 @@ func makeStoreCPUFn(
304304
storesPerNode := numStores / numNodes
305305
storeCPUs := make([]float64, numStores)
306306
for node, result := range resp.Results {
307+
if len(result.Datapoints) == 0 {
308+
// If any node has no datapoints, there isn't much point looking at
309+
// others because the comparison is useless.
310+
return nil, errors.Newf("node %d has no CPU datapoints", node)
311+
}
307312
// Take the latest CPU data point only.
308313
cpu := result.Datapoints[len(result.Datapoints)-1].Value
309314
nodeIdx := node * storesPerNode

0 commit comments

Comments
 (0)