diff --git a/engine/enginefuzz_test.go b/engine/enginefuzz_test.go index a1c60d563..3557612da 100644 --- a/engine/enginefuzz_test.go +++ b/engine/enginefuzz_test.go @@ -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": @@ -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": diff --git a/engine/testdata/fuzz/FuzzNativeHistogramQuery/df60c8694f1c9759 b/engine/testdata/fuzz/FuzzNativeHistogramQuery/df60c8694f1c9759 new file mode 100644 index 000000000..e3baa6eb3 --- /dev/null +++ b/engine/testdata/fuzz/FuzzNativeHistogramQuery/df60c8694f1c9759 @@ -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)