Skip to content

Commit 531dd58

Browse files
authored
Upgrade promqlsmith version to latest (#6689)
* upgrade promqlsmith version to latest Signed-off-by: yeya24 <[email protected]> * fix lint Signed-off-by: yeya24 <[email protected]> --------- Signed-off-by: yeya24 <[email protected]>
1 parent 709d15e commit 531dd58

File tree

7 files changed

+247
-90
lines changed

7 files changed

+247
-90
lines changed

Diff for: go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ require (
99
github.com/armon/go-metrics v0.4.1
1010
github.com/aws/aws-sdk-go v1.55.6
1111
github.com/bradfitz/gomemcache v0.0.0-20230905024940-24af94b03874
12-
github.com/cortexproject/promqlsmith v0.0.0-20250203072244-cbb5738d00ca
12+
github.com/cortexproject/promqlsmith v0.0.0-20250407233056-90db95b1a4e4
1313
github.com/dustin/go-humanize v1.0.1
1414
github.com/efficientgo/core v1.0.0-rc.3
1515
github.com/facette/natsort v0.0.0-20181210072756-2cd4dd1e2dcb

Diff for: go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -938,8 +938,8 @@ github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3Ee
938938
github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
939939
github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs=
940940
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
941-
github.com/cortexproject/promqlsmith v0.0.0-20250203072244-cbb5738d00ca h1:TvKuPFRUQ39O07xv3b+TO6GBRhchYKyBCCXrlmmDE3Y=
942-
github.com/cortexproject/promqlsmith v0.0.0-20250203072244-cbb5738d00ca/go.mod h1:xbYQa0KX6Eh6YWbTBfZ9kK3N4hRxX+ZPIfVIY2U/y00=
941+
github.com/cortexproject/promqlsmith v0.0.0-20250407233056-90db95b1a4e4 h1:dpo7kQ24uFSV6Zgm9/kB34TIUWjGmadlbKrM6fNfQko=
942+
github.com/cortexproject/promqlsmith v0.0.0-20250407233056-90db95b1a4e4/go.mod h1:jh6POgN18lXU133HBMfwr/1TjvBp8e5kL4ZtRsAPvGY=
943943
github.com/cortexproject/weaveworks-common v0.0.0-20241129212437-96019edf21f1 h1:UoSixdl0sBUhfEOMpIGxFnJjp3/y/+nkw6Du7su05FE=
944944
github.com/cortexproject/weaveworks-common v0.0.0-20241129212437-96019edf21f1/go.mod h1:7cl8fS/nivXe2DmBUUmr/3UGTJG2jVU2NRaIayR2Zjs=
945945
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=

Diff for: integration/query_fuzz_test.go

+5-14
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ func TestDisableChunkTrimmingFuzz(t *testing.T) {
397397
expr = ps.WalkRangeQuery()
398398
query = expr.Pretty(0)
399399
// timestamp is a known function that break with disable chunk trimming.
400-
if isValidQuery(expr, 5, false) && !strings.Contains(query, "timestamp") {
400+
if isValidQuery(expr, false) && !strings.Contains(query, "timestamp") {
401401
break
402402
}
403403
}
@@ -566,7 +566,7 @@ func TestExpandedPostingsCacheFuzz(t *testing.T) {
566566
matchers := make([]string, 0, testRun)
567567
for i := 0; i < testRun; i++ {
568568
expr := ps.WalkRangeQuery()
569-
if isValidQuery(expr, 5, true) {
569+
if isValidQuery(expr, true) {
570570
break
571571
}
572572
queries = append(queries, expr.Pretty(0))
@@ -1731,7 +1731,7 @@ func runQueryFuzzTestCases(t *testing.T, ps *promqlsmith.PromQLSmith, c1, c2 *e2
17311731
for i := 0; i < run; i++ {
17321732
for {
17331733
expr = ps.WalkInstantQuery()
1734-
if isValidQuery(expr, 5, skipStdAggregations) {
1734+
if isValidQuery(expr, skipStdAggregations) {
17351735
query = expr.Pretty(0)
17361736
break
17371737
}
@@ -1752,7 +1752,7 @@ func runQueryFuzzTestCases(t *testing.T, ps *promqlsmith.PromQLSmith, c1, c2 *e2
17521752
for i := 0; i < run; i++ {
17531753
for {
17541754
expr = ps.WalkRangeQuery()
1755-
if isValidQuery(expr, 5, skipStdAggregations) {
1755+
if isValidQuery(expr, skipStdAggregations) {
17561756
query = expr.Pretty(0)
17571757
break
17581758
}
@@ -1803,9 +1803,8 @@ func shouldUseSampleNumComparer(query string) bool {
18031803
return false
18041804
}
18051805

1806-
func isValidQuery(generatedQuery parser.Expr, maxDepth int, skipStdAggregations bool) bool {
1806+
func isValidQuery(generatedQuery parser.Expr, skipStdAggregations bool) bool {
18071807
isValid := true
1808-
currentDepth := 0
18091808
// TODO(SungJin1212): Test limitk, limit_ratio
18101809
if strings.Contains(generatedQuery.String(), "limitk") {
18111810
// current skip the limitk
@@ -1820,13 +1819,5 @@ func isValidQuery(generatedQuery parser.Expr, maxDepth int, skipStdAggregations
18201819
// If skipStdAggregations enabled, we skip to evaluate for stddev and stdvar aggregations.
18211820
return false
18221821
}
1823-
parser.Inspect(generatedQuery, func(node parser.Node, path []parser.Node) error {
1824-
if currentDepth > maxDepth {
1825-
isValid = false
1826-
return fmt.Errorf("generated query has exceeded maxDepth of %d", maxDepth)
1827-
}
1828-
currentDepth = len(path) + 1
1829-
return nil
1830-
})
18311822
return isValid
18321823
}

Diff for: vendor/github.com/cortexproject/promqlsmith/opts.go

+14
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: vendor/github.com/cortexproject/promqlsmith/promqlsmith.go

+65-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)