(generatedQuery parser.Expr, skipBackwardIncompat bool)
| 1825 | } |
| 1826 | |
| 1827 | func isValidQuery(generatedQuery parser.Expr, skipBackwardIncompat bool) bool { |
| 1828 | isValid := true |
| 1829 | queryStr := generatedQuery.String() |
| 1830 | // TODO(SungJin1212): Test limitk, limit_ratio |
| 1831 | if strings.Contains(queryStr, "limitk") { |
| 1832 | // current skip the limitk |
| 1833 | return false |
| 1834 | } |
| 1835 | if strings.Contains(queryStr, "limit_ratio") { |
| 1836 | // current skip the limit_ratio |
| 1837 | return false |
| 1838 | } |
| 1839 | if strings.Contains(queryStr, "--") { |
| 1840 | // The query fuzzer can generate nested unary negation operators (e.g. --0.5) |
| 1841 | // which are evaluated differently between Cortex versions. Skip these queries |
| 1842 | // to avoid false positives in backward compatibility tests. |
| 1843 | return false |
| 1844 | } |
| 1845 | if skipBackwardIncompat { |
| 1846 | // Skip functions and aggregations whose evaluation semantics changed across |
| 1847 | // Prometheus versions embedded in different Cortex releases. These produce |
| 1848 | // legitimately different results and are not Cortex bugs. |
| 1849 | if strings.Contains(queryStr, "stddev") || strings.Contains(queryStr, "stdvar") { |
| 1850 | // Changed in https://github.com/prometheus/prometheus/pull/14941 |
| 1851 | return false |
| 1852 | } |
| 1853 | if strings.Contains(queryStr, "quantile") { |
| 1854 | return false |
| 1855 | } |
| 1856 | if strings.Contains(queryStr, "predict_linear") { |
| 1857 | return false |
| 1858 | } |
| 1859 | if strings.Contains(queryStr, "atan2") { |
| 1860 | return false |
| 1861 | } |
| 1862 | } |
| 1863 | return isValid |
| 1864 | } |
| 1865 | |
| 1866 | func resultLength(x model.Value) int { |
| 1867 | vx, xvec := x.(model.Vector) |
no test coverage detected