Skip to content

Commit 565902d

Browse files
committed
Make chunk cache test case larger than batch size
Also comment one use of arbitrary integers in the test which is unrelated to test size. Signed-off-by: Bryan Boreham <[email protected]>
1 parent cae51e8 commit 565902d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pkg/chunk/cache/cache_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ const userID = "1"
2222
func fillCache(t *testing.T, cache cache.Cache) ([]string, []chunk.Chunk) {
2323
const chunkLen = 13 * 3600 // in seconds
2424

25-
// put 100 chunks from 0 to 99
25+
// put a set of chunks, larger than background batch size, with varying timestamps and values
2626
keys := []string{}
2727
bufs := [][]byte{}
2828
chunks := []chunk.Chunk{}
29-
for i := 0; i < 100; i++ {
29+
for i := 0; i < 111; i++ {
3030
ts := model.TimeFromUnix(int64(i * chunkLen))
3131
promChunk := prom_chunk.New()
3232
nc, err := promChunk.Add(model.SamplePair{
@@ -119,7 +119,7 @@ func (a byExternalKey) Less(i, j int) bool { return a[i].ExternalKey() < a[j].Ex
119119

120120
func testCacheMiss(t *testing.T, cache cache.Cache) {
121121
for i := 0; i < 100; i++ {
122-
key := strconv.Itoa(rand.Int())
122+
key := strconv.Itoa(rand.Int()) // arbitrary key which should fail: no chunk key is a single integer
123123
found, bufs, missing := cache.Fetch(context.Background(), []string{key})
124124
require.Empty(t, found)
125125
require.Empty(t, bufs)

0 commit comments

Comments
 (0)