Skip to content

Commit

Permalink
test(scaler_test.go): add cases for testing proper MinWait when scali…
Browse files Browse the repository at this point in the history
…ng factor is negative and current duration is time.Millisecond
  • Loading branch information
benjivesterby committed Mar 28, 2023
1 parent 68b49b7 commit 17e2d6d
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions scaler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,30 @@ func TestTickDur(t *testing.T) {
currentStep: 2,
expected: 10 * time.Second,
},
{
name: "Test case 7: testing below minwait",
tick: DurationScaler{
Interval: 1,
ScalingFactor: -0.999,
originalDuration: time.Millisecond * 2,
lastInterval: 0,
},
duration: MinWait,
currentStep: 1,
expected: MinWait,
},
{
name: "Test case 8: testing below minwait",
tick: DurationScaler{
Interval: 1,
ScalingFactor: -0.999,
originalDuration: time.Millisecond * 900,
lastInterval: 0,
},
duration: MinWait,
currentStep: 1,
expected: MinWait,
},
}

for _, tc := range testCases {
Expand Down

0 comments on commit 17e2d6d

Please sign in to comment.