From 6fceeec7648a3d4ee2be123c8678c9d986809416 Mon Sep 17 00:00:00 2001 From: Ben Ye Date: Thu, 12 Oct 2023 23:39:38 -0700 Subject: [PATCH] update test case Signed-off-by: Ben Ye --- integration/query_fuzz_test.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/integration/query_fuzz_test.go b/integration/query_fuzz_test.go index fa3e656344..196e408ebf 100644 --- a/integration/query_fuzz_test.go +++ b/integration/query_fuzz_test.go @@ -1,9 +1,7 @@ -//go:build integration_query_fuzz -// +build integration_query_fuzz - package integration import ( + "github.com/thanos-io/thanos/pkg/querysharding" "math/rand" "path" "sort" @@ -146,6 +144,7 @@ func TestVerticalShardingFuzz(t *testing.T) { now = time.Now() cases := make([]*testCase, 0, 100) + analyzer := querysharding.NewQueryAnalyzer() for i := 0; i < 100; i++ { var expr parser.Expr @@ -153,8 +152,13 @@ func TestVerticalShardingFuzz(t *testing.T) { // this is our main target to test. for { expr = ps.WalkRangeQuery() - if _, ok := expr.(*parser.AggregateExpr); ok { - break + if a, ok := expr.(*parser.AggregateExpr); ok && len(a.Grouping) == 0 { + qa, err := analyzer.Analyze(a.Expr.String()) + require.NoError(t, err) + // Let's focus on outer query not shardable but inner query shardable case. + if qa.IsShardable() { + break + } } } query := expr.Pretty(0)