MCPcopy Index your code
hub / github.com/cortexproject/cortex / TestShortTermQueryToLTS

Function TestShortTermQueryToLTS

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

Source from the content-addressed store, hash-verified

1509}
1510
1511func TestShortTermQueryToLTS(t *testing.T) {
1512 testCases := []struct {
1513 name string
1514 mint, maxt time.Time
1515 hitIngester bool
1516 hitLTS bool
1517 queryIngestersWithin time.Duration
1518 queryStoreAfter time.Duration
1519 }{
1520 {
1521 name: "hit only ingester",
1522 mint: time.Now().Add(-5 * time.Minute),
1523 maxt: time.Now(),
1524 hitIngester: true,
1525 hitLTS: false,
1526 queryIngestersWithin: 1 * time.Hour,
1527 queryStoreAfter: time.Hour,
1528 },
1529 {
1530 name: "hit both",
1531 mint: time.Now().Add(-5 * time.Hour),
1532 maxt: time.Now(),
1533 hitIngester: true,
1534 hitLTS: true,
1535 queryIngestersWithin: 1 * time.Hour,
1536 queryStoreAfter: time.Hour,
1537 },
1538 {
1539 name: "hit only storage",
1540 mint: time.Now().Add(-5 * time.Hour),
1541 maxt: time.Now().Add(-2 * time.Hour),
1542 hitIngester: false,
1543 hitLTS: true,
1544 queryIngestersWithin: 1 * time.Hour,
1545 queryStoreAfter: 0,
1546 },
1547 }
1548
1549 engine := promql.NewEngine(promql.EngineOpts{
1550 Logger: promslog.NewNopLogger(),
1551 MaxSamples: 1e6,
1552 Timeout: 1 * time.Minute,
1553 })
1554
1555 cfg := Config{}
1556 flagext.DefaultValues(&cfg)
1557 // Disable active query tracker to avoid mmap error.
1558 cfg.ActiveQueryTrackerDir = ""
1559
1560 for _, c := range testCases {
1561 cfg.QueryIngestersWithin = c.queryIngestersWithin
1562 cfg.QueryStoreAfter = c.queryStoreAfter
1563 t.Run(c.name, func(t *testing.T) {
1564 //parallel testing causes data race
1565 chunkStore := &emptyChunkStore{}
1566 distributor := &errDistributor{}
1567
1568 overrides := validation.NewOverrides(DefaultLimitsConfig(), nil)

Callers

nothing calls this directly

Calls 14

NewRangeQueryMethod · 0.95
IsCalledMethod · 0.95
DefaultValuesFunction · 0.92
NewOverridesFunction · 0.92
DefaultLimitsConfigFunction · 0.85
UseAlwaysQueryableFunction · 0.85
NewMockStoreQueryableFunction · 0.85
NewFunction · 0.70
RunMethod · 0.65
ExecMethod · 0.65
EqualMethod · 0.65
WrapMethod · 0.65

Tested by

no test coverage detected