(t *testing.T)
| 1857 | } |
| 1858 | |
| 1859 | func TestMaxQuerySamples(t *testing.T) { |
| 1860 | storage := promqltest.LoadedStorage(t, ` |
| 1861 | load 10s |
| 1862 | metric 1+1x100 |
| 1863 | bigmetric{a="1"} 1+1x100 |
| 1864 | bigmetric{a="2"} 1+1x100 |
| 1865 | `) |
| 1866 | |
| 1867 | // These test cases should be touching the limit exactly (hence no exceeding). |
| 1868 | // Exceeding the limit will be tested by doing -1 to the MaxSamples. |
| 1869 | cases := []struct { |
| 1870 | Query string |
| 1871 | MaxSamples int |
| 1872 | Start time.Time |
| 1873 | End time.Time |
| 1874 | Interval time.Duration |
| 1875 | }{ |
| 1876 | // Instant queries. |
| 1877 | { |
| 1878 | Query: "1", |
| 1879 | MaxSamples: 1, |
| 1880 | Start: time.Unix(1, 0), |
| 1881 | }, |
| 1882 | { |
| 1883 | Query: "metric", |
| 1884 | MaxSamples: 1, |
| 1885 | Start: time.Unix(1, 0), |
| 1886 | }, |
| 1887 | { |
| 1888 | Query: "metric[20s]", |
| 1889 | MaxSamples: 2, |
| 1890 | Start: time.Unix(10, 0), |
| 1891 | }, |
| 1892 | { |
| 1893 | Query: "rate(metric[20s])", |
| 1894 | MaxSamples: 3, |
| 1895 | Start: time.Unix(10, 0), |
| 1896 | }, |
| 1897 | { |
| 1898 | Query: "metric[20s:5s]", |
| 1899 | MaxSamples: 3, |
| 1900 | Start: time.Unix(10, 0), |
| 1901 | }, |
| 1902 | { |
| 1903 | Query: "metric[20s] @ 10", |
| 1904 | MaxSamples: 2, |
| 1905 | Start: time.Unix(0, 0), |
| 1906 | }, |
| 1907 | // Range queries. |
| 1908 | { |
| 1909 | Query: "1", |
| 1910 | MaxSamples: 3, |
| 1911 | Start: time.Unix(0, 0), |
| 1912 | End: time.Unix(2, 0), |
| 1913 | Interval: time.Second, |
| 1914 | }, |
| 1915 | { |
| 1916 | Query: "1", |
nothing calls this directly
no test coverage detected
searching dependent graphs…