Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions engine/enginefuzz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@ func shouldValidateSamples(expr parser.Expr) bool {

parser.Inspect(expr, func(node parser.Node, path []parser.Node) error {
switch n := node.(type) {
case *parser.VectorSelector:
if n.Timestamp != nil || n.StartOrEnd != 0 {
// The Thanos engine's step invariant operator caches the result of the
// first evaluation and replays it for subsequent steps without re-counting
// samples. This leads to fewer total samples compared to Prometheus which
// counts samples at every step.
valid = false
return errors.New("error")
}
case *parser.Call:
switch n.Func.Name {
case "scalar":
Expand All @@ -81,6 +90,14 @@ func validateExpr(expr parser.Expr, testType testType) bool {

parser.Inspect(expr, func(node parser.Node, path []parser.Node) error {
switch n := node.(type) {
case *parser.AggregateExpr:
if n.Op == parser.COUNT_VALUES {
// count_values converts float values to string labels. Tiny floating point
// precision differences between engines (e.g. 61.24999999999997 vs 61.24999999999998)
// produce different label values, causing result mismatches.
valid = false
return errors.New("error")
}
case *parser.Call:
switch n.Func.Name {
case "sort", "sort_desc", "sort_by_label", "sort_by_label_desc":
Expand Down
10 changes: 10 additions & 0 deletions engine/testdata/fuzz/FuzzNativeHistogramQuery/df60c8694f1c9759
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
go test fuzz v1
int64(-57)
uint32(27)
uint32(248)
uint32(12)
int8(0)
int8(0)
uint64(1)
uint64(1)
uint64(16)