Skip to content

Commit b458492

Browse files
committed
Fix tests
1 parent a611dff commit b458492

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

algorithm/algorithm_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ func TestSlidingWindowAutoscaler_Scale_BasicScaling(t *testing.T) {
185185
panicValue: 2500,
186186
readyPodCount: 2,
187187
},
188-
expectedPodCount: 3, // ceil(2500/1000) = 3
188+
expectedPodCount: 5, // ceil(2 * 2500/1000) = 5
189189
},
190190
{
191191
name: "total target value - scale down",
@@ -200,7 +200,7 @@ func TestSlidingWindowAutoscaler_Scale_BasicScaling(t *testing.T) {
200200
panicValue: 500,
201201
readyPodCount: 5,
202202
},
203-
expectedPodCount: 2, // limited by max scale down rate (5/2.0)
203+
expectedPodCount: 3, // ceil(5 * 500/1000) = 3
204204
},
205205
{
206206
name: "total target value with activation scale",
@@ -325,8 +325,9 @@ func TestSlidingWindowAutoscaler_Scale_PanicMode_TotalTargetValue(t *testing.T)
325325
if !recommendation.InPanicMode {
326326
t.Error("expected to enter panic mode")
327327
}
328-
if recommendation.DesiredPodCount != 5 {
329-
t.Errorf("expected pod count 5, got %d", recommendation.DesiredPodCount)
328+
// 2 pods * 5000 / 1000 = 10 pods
329+
if recommendation.DesiredPodCount != 10 {
330+
t.Errorf("expected pod count 10, got %d", recommendation.DesiredPodCount)
330331
}
331332
}
332333

0 commit comments

Comments
 (0)