Skip to content

Commit 6b4b01f

Browse files
committed
tuningSet: fix TimeLimitedLoad for zero actions
When creating a scale test that scales with number of nodes, it's possible that for small scale clusters some of the objects are not created, resulting in number of actions equal to zero for specific phase. For TimeLimitedLoad it caused panic due to division by zero. Signed-off-by: Marcel Zieba <[email protected]>
1 parent ddea3fb commit 6b4b01f

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

clusterloader2/pkg/tuningset/time_limited.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ func newTimeLimitedLoad(params *api.TimeLimitedLoad) TuningSet {
3434
}
3535

3636
func (t *timeLimitedLoad) Execute(actions []func()) {
37+
if len(actions) == 0 {
38+
return
39+
}
3740
sleepDuration := time.Duration(t.params.TimeLimit.ToTimeDuration().Nanoseconds() / int64(len(actions)))
3841
var wg wait.Group
3942
for i := range actions {

0 commit comments

Comments
 (0)