mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
Fix typo
Signed-off-by: Marco Pracucci <marco@pracucci.com>
This commit is contained in:
parent
3c68ce252e
commit
e2c1e7aadc
|
@ -858,9 +858,9 @@ func NewPostingsCloner(p Postings) *PostingsCloner {
|
|||
// so the returned slice capacity may be well above the actual number of items.
|
||||
// In such case, we shrink it.
|
||||
if float64(len(ids)) < float64(cap(ids))*0.70 {
|
||||
shrinked := make([]storage.SeriesRef, len(ids))
|
||||
copy(shrinked, ids)
|
||||
ids = shrinked
|
||||
shrunk := make([]storage.SeriesRef, len(ids))
|
||||
copy(shrunk, ids)
|
||||
ids = shrunk
|
||||
}
|
||||
|
||||
return &PostingsCloner{ids: ids, err: err}
|
||||
|
|
|
@ -1108,13 +1108,13 @@ func TestNewPostingsCloner_ShrinkExpandedPostingsSlice(t *testing.T) {
|
|||
t.Run("should not shrink expanded postings if length is >= 70% capacity", func(t *testing.T) {
|
||||
cloner := NewPostingsCloner(NewListPostings(make([]storage.SeriesRef, 60)))
|
||||
assert.Equal(t, 60, len(cloner.ids))
|
||||
assert.Equal(t, 64, cap(cloner.ids)) // Not shrinked.
|
||||
assert.Equal(t, 64, cap(cloner.ids)) // Not shrunk.
|
||||
})
|
||||
|
||||
t.Run("should shrink expanded postings if length is < 70% capacity", func(t *testing.T) {
|
||||
cloner := NewPostingsCloner(NewListPostings(make([]storage.SeriesRef, 33)))
|
||||
assert.Equal(t, 33, len(cloner.ids))
|
||||
assert.Equal(t, 33, cap(cloner.ids)) // Shrinked.
|
||||
assert.Equal(t, 33, cap(cloner.ids)) // Shrunk.
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue