From 128c0fbc99c06394832c49cea80c36436197c0a4 Mon Sep 17 00:00:00 2001 From: Christian Haudum Date: Thu, 15 Feb 2024 12:39:27 +0100 Subject: [PATCH] Fix tests Signed-off-by: Christian Haudum --- pkg/bloomutils/ring_test.go | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/pkg/bloomutils/ring_test.go b/pkg/bloomutils/ring_test.go index f3e8884ec29fa..c9ff6cf5e1d60 100644 --- a/pkg/bloomutils/ring_test.go +++ b/pkg/bloomutils/ring_test.go @@ -6,8 +6,6 @@ import ( "github.com/grafana/dskit/ring" "github.com/stretchr/testify/require" - - v1 "github.com/grafana/loki/pkg/storage/bloom/v1" ) func TestBloomGatewayClient_InstanceSortMergeIterator(t *testing.T) { @@ -38,11 +36,15 @@ func TestBloomGatewayClient_InstanceSortMergeIterator(t *testing.T) { } } +func uint64Range(min, max uint64) Range[uint64] { + return Range[uint64]{min, max} +} + func TestBloomGatewayClient_KeyRangeForInstance(t *testing.T) { for name, tc := range map[string]struct { id string input []ring.InstanceDesc - expected v1.FingerprintBounds + expected Range[uint64] }{ "first instance includes 0 token": { id: "3", @@ -51,7 +53,7 @@ func TestBloomGatewayClient_KeyRangeForInstance(t *testing.T) { {Id: "2", Tokens: []uint32{5}}, {Id: "3", Tokens: []uint32{1}}, }, - expected: v1.NewBounds(0, math.MaxUint64/3-1), + expected: uint64Range(0, math.MaxUint64/3-1), }, "middle instance": { id: "1", @@ -60,7 +62,7 @@ func TestBloomGatewayClient_KeyRangeForInstance(t *testing.T) { {Id: "2", Tokens: []uint32{5}}, {Id: "3", Tokens: []uint32{1}}, }, - expected: v1.NewBounds(math.MaxUint64/3, math.MaxUint64/3*2-1), + expected: uint64Range(math.MaxUint64/3, math.MaxUint64/3*2-1), }, "last instance includes MaxUint32 token": { id: "2", @@ -69,12 +71,12 @@ func TestBloomGatewayClient_KeyRangeForInstance(t *testing.T) { {Id: "2", Tokens: []uint32{5}}, {Id: "3", Tokens: []uint32{1}}, }, - expected: v1.NewBounds(math.MaxUint64/3*2, math.MaxUint64), + expected: uint64Range(math.MaxUint64/3*2, math.MaxUint64), }, } { tc := tc t.Run(name, func(t *testing.T) { - result, err := KeyRangeForInstance(tc.id, tc.input, Uint32Range) + result, err := KeyRangeForInstance(tc.id, tc.input, Uint64Range) require.NoError(t, err) require.Equal(t, tc.expected, result) })