From df8f967040e99f0bbd5a5a36abfd89e42515d3e2 Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Sun, 24 Oct 2021 13:31:12 +0300 Subject: [PATCH] app/vmselect/promql: reduce the precision from 15 significant digits to 13 significant digits when comparing float64 results in tests See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1738 --- app/vmselect/promql/rollup_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/vmselect/promql/rollup_test.go b/app/vmselect/promql/rollup_test.go index e1c22eb6d..c7ecaf8a3 100644 --- a/app/vmselect/promql/rollup_test.go +++ b/app/vmselect/promql/rollup_test.go @@ -1167,7 +1167,9 @@ func testRowsEqual(t *testing.T, values []float64, timestamps []int64, valuesExp } continue } - if math.Abs(v-vExpected) > 1e-15 { + // Compare values with the reduced precision because of different precision errors + // on different OS/architectures. See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1738 + if math.Abs(v-vExpected) > 1e-13 { t.Fatalf("unexpected value at values[%d]; got %f; want %f\nvalues=\n%v\nvaluesExpected=\n%v", i, v, vExpected, values, valuesExpected) }