Skip to content

Commit 17e2d6d

Browse files
committed
test(scaler_test.go): add cases for testing proper MinWait when scaling factor is negative and current duration is time.Millisecond
1 parent 68b49b7 commit 17e2d6d

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

scaler_test.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,30 @@ func TestTickDur(t *testing.T) {
379379
currentStep: 2,
380380
expected: 10 * time.Second,
381381
},
382+
{
383+
name: "Test case 7: testing below minwait",
384+
tick: DurationScaler{
385+
Interval: 1,
386+
ScalingFactor: -0.999,
387+
originalDuration: time.Millisecond * 2,
388+
lastInterval: 0,
389+
},
390+
duration: MinWait,
391+
currentStep: 1,
392+
expected: MinWait,
393+
},
394+
{
395+
name: "Test case 8: testing below minwait",
396+
tick: DurationScaler{
397+
Interval: 1,
398+
ScalingFactor: -0.999,
399+
originalDuration: time.Millisecond * 900,
400+
lastInterval: 0,
401+
},
402+
duration: MinWait,
403+
currentStep: 1,
404+
expected: MinWait,
405+
},
382406
}
383407

384408
for _, tc := range testCases {

0 commit comments

Comments
 (0)