Skip to content

Commit

Permalink
update test case
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Ye <[email protected]>
  • Loading branch information
yeya24 committed Oct 13, 2023
1 parent c32b11e commit 6fceeec
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions integration/query_fuzz_test.go
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -146,15 +144,21 @@ 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
// Let's make sure we generate aggregation expression only as
// 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)
Expand Down

0 comments on commit 6fceeec

Please sign in to comment.