Skip to content

Commit 34d483b

Browse files
authored
chore: fix vertical scaling pod matcher (#10259)
1 parent 397baf0 commit 34d483b

1 file changed

Lines changed: 3 additions & 7 deletions

File tree

pkg/operations/vertical_scaling_test.go

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -402,10 +402,6 @@ var _ = Describe("verticalScalingHandler resource match contract", func() {
402402
}
403403
}
404404

405-
makeInstance := func(pod *corev1.Pod) Instance {
406-
return &defaultInstance{name: podName, componentName: clusterCompName, pod: pod}
407-
}
408-
409405
makePgRes := func(target corev1.ResourceRequirements) *progressResource {
410406
return &progressResource{
411407
updatedPodSet: map[string]string{podName: constant.EmptyInsTemplateName},
@@ -431,7 +427,7 @@ var _ = Describe("verticalScalingHandler resource match contract", func() {
431427
},
432428
}
433429
pod := makePod(target.Limits.DeepCopy(), target.Requests.DeepCopy())
434-
Expect(vs.podApplyCompOps(ops, makeInstance(pod), makePgRes(target))).Should(BeTrue())
430+
Expect(vs.podApplyCompOps(ops, pod, makePgRes(target))).Should(BeTrue())
435431
})
436432

437433
It("defaults an absent request key to its limit value when comparing", func() {
@@ -450,7 +446,7 @@ var _ = Describe("verticalScalingHandler resource match contract", func() {
450446
corev1.ResourceMemory: resource.MustParse("2Gi"),
451447
}
452448
pod := makePod(target.Limits.DeepCopy(), podRequests)
453-
Expect(vs.podApplyCompOps(ops, makeInstance(pod), makePgRes(target))).Should(BeTrue())
449+
Expect(vs.podApplyCompOps(ops, pod, makePgRes(target))).Should(BeTrue())
454450
})
455451

456452
It("returns false when the Pod's actual requests differ from the target", func() {
@@ -469,6 +465,6 @@ var _ = Describe("verticalScalingHandler resource match contract", func() {
469465
corev1.ResourceMemory: resource.MustParse("2Gi"),
470466
}
471467
pod := makePod(target.Limits.DeepCopy(), podRequests)
472-
Expect(vs.podApplyCompOps(ops, makeInstance(pod), makePgRes(target))).Should(BeFalse())
468+
Expect(vs.podApplyCompOps(ops, pod, makePgRes(target))).Should(BeFalse())
473469
})
474470
})

0 commit comments

Comments
 (0)