MCPcopy Create free account
hub / github.com/cortexproject/cortex / TestQuerier_ProjectionHints

Function TestQuerier_ProjectionHints

pkg/querier/querier_test.go:1742–1867  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1740}
1741
1742func TestQuerier_ProjectionHints(t *testing.T) {
1743 t.Parallel()
1744 start := time.Now().Add(-2 * time.Hour)
1745 end := time.Now()
1746 ctx := user.InjectOrgID(context.Background(), "0")
1747
1748 tests := map[string]struct {
1749 honorProjectionHints bool
1750 inputProjectionInclude bool
1751 inputProjectionLabels []string
1752 queryIngesters bool // Whether ingesters should be queried
1753 expectedProjectionInclude bool
1754 expectedProjectionLabels []string
1755 }{
1756 "projection preserved: honor enabled, projection included, not querying ingesters": {
1757 honorProjectionHints: true,
1758 inputProjectionInclude: true,
1759 inputProjectionLabels: []string{"__name__", "job"},
1760 queryIngesters: false,
1761 expectedProjectionInclude: true,
1762 expectedProjectionLabels: []string{"__name__", "job"},
1763 },
1764 "projection reset: honor enabled, projection included, querying ingesters": {
1765 honorProjectionHints: true,
1766 inputProjectionInclude: true,
1767 inputProjectionLabels: []string{"__name__", "job"},
1768 queryIngesters: true,
1769 expectedProjectionInclude: false,
1770 expectedProjectionLabels: nil,
1771 },
1772 "projection reset: honor enabled, projection not included": {
1773 honorProjectionHints: true,
1774 inputProjectionInclude: false,
1775 inputProjectionLabels: []string{"__name__", "job"},
1776 queryIngesters: false,
1777 expectedProjectionInclude: false,
1778 expectedProjectionLabels: nil,
1779 },
1780 "projection not modified: honor disabled, projection included, querying ingesters": {
1781 honorProjectionHints: false,
1782 inputProjectionInclude: true,
1783 inputProjectionLabels: []string{"__name__", "job"},
1784 queryIngesters: true,
1785 expectedProjectionInclude: true,
1786 expectedProjectionLabels: []string{"__name__", "job"},
1787 },
1788 "projection not modified: honor disabled, projection not included": {
1789 honorProjectionHints: false,
1790 inputProjectionInclude: false,
1791 inputProjectionLabels: []string{"__name__", "job"},
1792 queryIngesters: false,
1793 expectedProjectionInclude: false,
1794 expectedProjectionLabels: []string{"__name__", "job"},
1795 },
1796 }
1797
1798 for testName, testData := range tests {
1799 t.Run(testName, func(t *testing.T) {

Callers

nothing calls this directly

Calls 15

DefaultValuesFunction · 0.92
NewOverridesFunction · 0.92
TimeToMillisFunction · 0.92
DefaultLimitsConfigFunction · 0.85
UseAlwaysQueryableFunction · 0.85
NewMockStoreQueryableFunction · 0.85
newDistributorQueryableFunction · 0.85
NewQueryableFunction · 0.70
RunMethod · 0.65
NextMethod · 0.65
ErrMethod · 0.65

Tested by

no test coverage detected