waitUntilReady is a helper function to wait and check if both servers to test load the expected data.
(t *testing.T, ctx context.Context, c1, c2 *e2ecortex.Client, query string, start, end time.Time)
| 1703 | |
| 1704 | // waitUntilReady is a helper function to wait and check if both servers to test load the expected data. |
| 1705 | func waitUntilReady(t *testing.T, ctx context.Context, c1, c2 *e2ecortex.Client, query string, start, end time.Time) { |
| 1706 | retries := backoff.New(ctx, backoff.Config{ |
| 1707 | MinBackoff: 5 * time.Second, |
| 1708 | MaxBackoff: 10 * time.Second, |
| 1709 | MaxRetries: 5, |
| 1710 | }) |
| 1711 | |
| 1712 | var ( |
| 1713 | labelSet1 []model.LabelSet |
| 1714 | labelSet2 []model.LabelSet |
| 1715 | err error |
| 1716 | ) |
| 1717 | // Wait until both Cortex and Prometheus load the block. |
| 1718 | for retries.Ongoing() { |
| 1719 | labelSet1, err = c1.Series([]string{query}, start, end) |
| 1720 | require.NoError(t, err) |
| 1721 | labelSet2, err = c2.Series([]string{query}, start, end) |
| 1722 | require.NoError(t, err) |
| 1723 | |
| 1724 | // Make sure series can be queried. |
| 1725 | if len(labelSet1) > 0 { |
| 1726 | if cmp.Equal(labelSet1, labelSet2, labelSetsComparer) { |
| 1727 | break |
| 1728 | } |
| 1729 | } |
| 1730 | |
| 1731 | retries.Wait() |
| 1732 | } |
| 1733 | if err := retries.Err(); err != nil { |
| 1734 | t.Fatalf("failed to wait for ready, error: %v", err) |
| 1735 | } |
| 1736 | } |
| 1737 | |
| 1738 | // runQueryFuzzTestCases executes the fuzz test for the specified number of runs for both instant and range queries. |
| 1739 | func runQueryFuzzTestCases(t *testing.T, ps *promqlsmith.PromQLSmith, c1, c2 *e2ecortex.Client, queryTime, start, end time.Time, step time.Duration, run int, skipStdAggregations bool) { |
no test coverage detected