From 56519742aa7fee7b2ed616a9083d9f60b10e93fa Mon Sep 17 00:00:00 2001 From: Ben Ye Date: Wed, 4 Dec 2024 17:25:22 -0800 Subject: [PATCH] fix unit tests Signed-off-by: Ben Ye --- pkg/block/block_test.go | 12 ++++++++---- pkg/block/index_test.go | 5 ++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/pkg/block/block_test.go b/pkg/block/block_test.go index 1ebe6b1c6a..ce72ab74c1 100644 --- a/pkg/block/block_test.go +++ b/pkg/block/block_test.go @@ -144,7 +144,7 @@ func TestUpload(t *testing.T) { testutil.Equals(t, 3, len(bkt.Objects())) testutil.Equals(t, 3727, len(bkt.Objects()[path.Join(b1.String(), ChunksDirname, "000001")])) testutil.Equals(t, 401, len(bkt.Objects()[path.Join(b1.String(), IndexFilename)])) - testutil.Equals(t, 595, len(bkt.Objects()[path.Join(b1.String(), MetaFilename)])) + testutil.Equals(t, 702, len(bkt.Objects()[path.Join(b1.String(), MetaFilename)])) // File stats are gathered. testutil.Equals(t, fmt.Sprintf(`{ @@ -185,7 +185,11 @@ func TestUpload(t *testing.T) { } ], "index_stats": { - "series_max_size": 16 + "series_max_size": 16, + "series_p90_size": 16, + "series_p99_size": 16, + "series_p999_size": 16, + "series_p9999_size": 16 } } } @@ -197,7 +201,7 @@ func TestUpload(t *testing.T) { testutil.Equals(t, 3, len(bkt.Objects())) testutil.Equals(t, 3727, len(bkt.Objects()[path.Join(b1.String(), ChunksDirname, "000001")])) testutil.Equals(t, 401, len(bkt.Objects()[path.Join(b1.String(), IndexFilename)])) - testutil.Equals(t, 595, len(bkt.Objects()[path.Join(b1.String(), MetaFilename)])) + testutil.Equals(t, 702, len(bkt.Objects()[path.Join(b1.String(), MetaFilename)])) } { // Upload with no external labels should be blocked. @@ -229,7 +233,7 @@ func TestUpload(t *testing.T) { testutil.Equals(t, 6, len(bkt.Objects())) testutil.Equals(t, 3727, len(bkt.Objects()[path.Join(b2.String(), ChunksDirname, "000001")])) testutil.Equals(t, 401, len(bkt.Objects()[path.Join(b2.String(), IndexFilename)])) - testutil.Equals(t, 574, len(bkt.Objects()[path.Join(b2.String(), MetaFilename)])) + testutil.Equals(t, 681, len(bkt.Objects()[path.Join(b2.String(), MetaFilename)])) } } diff --git a/pkg/block/index_test.go b/pkg/block/index_test.go index 08a3b47612..32ed5e2b65 100644 --- a/pkg/block/index_test.go +++ b/pkg/block/index_test.go @@ -5,19 +5,18 @@ package block import ( "context" - "github.com/stretchr/testify/require" "math" "os" "path/filepath" "testing" + "github.com/efficientgo/core/testutil" "github.com/go-kit/log" "github.com/prometheus/prometheus/model/labels" "github.com/prometheus/prometheus/tsdb" "github.com/prometheus/prometheus/tsdb/chunks" "github.com/prometheus/prometheus/tsdb/index" - - "github.com/efficientgo/core/testutil" + "github.com/stretchr/testify/require" "github.com/thanos-io/thanos/pkg/block/metadata" "github.com/thanos-io/thanos/pkg/testutil/e2eutil"