promql-engine icon indicating copy to clipboard operation
promql-engine copied to clipboard

Reorganize function tests

Open GiedriusS opened this issue 2 years ago • 6 comments
trafficstars

https://github.com/thanos-community/promql-engine/pull/142#pullrequestreview-1238495639

With lots of functions, it's hard to understand what is being tested and what is not. Reorganize the tests to make them clearer.

GiedriusS avatar Jan 06 '23 08:01 GiedriusS

I'd love to help with this, what way of reorganizing do you suggest? @GiedriusS @fpetkovski

fatsheep9146 avatar Jan 11 '23 03:01 fatsheep9146

First thing I would suggest is merging instant and range query tests, so that we add test cases in only one place. I would look into how we can define multiple expressions in a test case for a single load. This way we don't need to repeat the loaded series over and over when we add a new function.

fpetkovski avatar Jan 11 '23 07:01 fpetkovski

I was thinking maybe we could cover more cases in the fuzzer https://github.com/thanos-community/promql-engine/blob/main/engine/enginefuzz_test.go#L21 and we could remove simple cases from that testing function https://github.com/thanos-community/promql-engine/pull/142#pullrequestreview-1238495639.

GiedriusS avatar Jan 16 '23 08:01 GiedriusS

/assign

rakeshkumarnahak avatar Feb 08 '23 14:02 rakeshkumarnahak

I wonder, why does the enginefuzz_test.go not generate NaN or Inf values that seems like it could produce interesting edge cases!

MichaHoffmann avatar Feb 25 '23 10:02 MichaHoffmann

Up until recently we had no support for NaN comparisons since there are many different ways to represent a NaN in go. We could it it now though, and use cmpopts.EquateNaNs() as in https://github.com/thanos-community/promql-engine/blob/main/engine/engine_test.go#L1565.

fpetkovski avatar Feb 26 '23 09:02 fpetkovski