Skip to content

Commit 4a233bf

Browse files
committed
Address review comments
1 parent 72c2f93 commit 4a233bf

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

vertical-pod-autoscaler/pkg/recommender/util/histogram_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,13 +281,17 @@ func TestHistogramIsNotEmptyAfterSavingAndLoadingCheckpointsWithBoundaryValues(t
281281
// Upon loading from the VPACheckpoint, the histogram reconstructs its weights using a calculated ratio,
282282
// aimed at reverting integer weights back to float values. This ratio is derived from:
283283
// (`w1` + `w2`) / (`wi1` + `wi2`)
284-
// Reference: https://github.com/plkokanov/autoscaler/blob/2aba67154cd4f117da4702b60a10c38c0651e659/vertical-pod-autoscaler/pkg/recommender/util/histogram.go#L256-L269
284+
// Reference: https://github.com/kubernetes/autoscaler/blob/aa1d413ea3bf319b56c7b2e65ade1a028e149439/vertical-pod-autoscaler//pkg/recommender/util/histogram.go#L256-L269
285285

286286
// Given the maximum potential values for `w1`, `w2`, `wi1` and `wi2` we arrive at:
287287
// (`epsilon` + `MaxCheckpointWeight` * `epsilon` - `epsilon`) / (1 + MaxCheckpointWeight) = epsilon * `MaxCheckpointWeight` / (1 + MaxCheckpointWeight)
288288

289289
// Consequently, the maximum value for this ratio is less than `epsilon`, implying that when `w1`,
290290
// initially scaled to `1`, is adjusted by this ratio, its recalculated weight falls short of `epsilon`.
291+
// When the `minBucket`'s weight is less than `epsilon`, the `histogram.IsEmpty()` returns true.
292+
// Reference: https://github.com/kubernetes/autoscaler/blob/aa1d413ea3bf319b56c7b2e65ade1a028e149439/vertical-pod-autoscaler/pkg/recommender/util/histogram.go#L181-L183
293+
// Consequently, the `histogram.Percentile(...)` function will always return 0.
294+
// Reference: https://github.com/kubernetes/autoscaler/blob/aa1d413ea3bf319b56c7b2e65ade1a028e149439/vertical-pod-autoscaler/pkg/recommender/util/histogram.go#L159-L162
291295
// The same behavior can be observed when there are more than two weights.
292296

293297
// This test ensures that in such cases the histogram does not become empty.

0 commit comments

Comments
 (0)