From 65efa8f95a7eab6485660e00a27ee836b10d66b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gy=C3=B6rgy=20Krajcsovits?= Date: Thu, 5 Feb 2026 18:44:01 +0100 Subject: [PATCH] test the case where st equals the t MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: György Krajcsovits --- tsdb/chunkenc/st_helper_test.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tsdb/chunkenc/st_helper_test.go b/tsdb/chunkenc/st_helper_test.go index e3d64e31c0..fa9c9b451c 100644 --- a/tsdb/chunkenc/st_helper_test.go +++ b/tsdb/chunkenc/st_helper_test.go @@ -92,6 +92,11 @@ func testChunkSTHandling(t *testing.T, vt ValueType, chunkFactory func() Chunk) }) stTimes := []int64{0, 500, 1000, 1500, 2000, 2500, 3000, 3500, 4000} + + ts := func(j int) int64 { + return int64(1000 * (j + 1)) + } + for numberOfSamples := range 5 { samples := make([]triple, numberOfSamples) sampleSTidx := make([]int, numberOfSamples) @@ -99,7 +104,7 @@ func testChunkSTHandling(t *testing.T, vt ValueType, chunkFactory func() Chunk) for j := range numberOfSamples { samples[j] = triple{ st: stTimes[sampleSTidx[j]], - t: int64(1000 * (j + 1)), + t: ts(j), v: float64(j) + 0.5, } } @@ -110,7 +115,7 @@ func testChunkSTHandling(t *testing.T, vt ValueType, chunkFactory func() Chunk) exhausted := true for j := numberOfSamples - 1; j >= 0; j-- { - if sampleSTidx[j] < j+2 { + if stTimes[sampleSTidx[j]] < ts(j) { sampleSTidx[j]++ exhausted = false break