promql-engine
promql-engine copied to clipboard
Reorganize function tests
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.
I'd love to help with this, what way of reorganizing do you suggest? @GiedriusS @fpetkovski
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.
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.
/assign
I wonder, why does the enginefuzz_test.go not generate NaN or Inf values that seems like it could produce interesting edge cases!
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.