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

Function TestNoHistoricalQueryToIngester

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

Source from the content-addressed store, hash-verified

605}
606
607func TestNoHistoricalQueryToIngester(t *testing.T) {
608 testCases := []struct {
609 name string
610 mint, maxt time.Time
611 hitIngester bool
612 queryIngestersWithin time.Duration
613 }{
614 {
615 name: "hit-test1",
616 mint: time.Now().Add(-5 * time.Hour),
617 maxt: time.Now().Add(1 * time.Hour),
618 hitIngester: true,
619 queryIngestersWithin: 1 * time.Hour,
620 },
621 {
622 name: "hit-test2",
623 mint: time.Now().Add(-5 * time.Hour),
624 maxt: time.Now().Add(-55 * time.Minute),
625 hitIngester: true,
626 queryIngestersWithin: 1 * time.Hour,
627 },
628 { // Skipping ingester is disabled.
629 name: "hit-test2",
630 mint: time.Now().Add(-5 * time.Hour),
631 maxt: time.Now().Add(-50 * time.Minute),
632 hitIngester: true,
633 queryIngestersWithin: 0,
634 },
635 {
636 name: "dont-hit-test1",
637 mint: time.Now().Add(-5 * time.Hour),
638 maxt: time.Now().Add(-100 * time.Minute),
639 hitIngester: false,
640 queryIngestersWithin: 1 * time.Hour,
641 },
642 {
643 name: "dont-hit-test2",
644 mint: time.Now().Add(-5 * time.Hour),
645 maxt: time.Now().Add(-61 * time.Minute),
646 hitIngester: false,
647 queryIngestersWithin: 1 * time.Hour,
648 },
649 }
650
651 opts := promql.EngineOpts{
652 Logger: promslog.NewNopLogger(),
653 MaxSamples: 1e6,
654 Timeout: 1 * time.Minute,
655 }
656 cfg := Config{}
657 // Disable active query tracker to avoid mmap error.
658 cfg.ActiveQueryTrackerDir = ""
659 for _, thanosEngine := range []bool{true, false} {
660 for _, encoding := range encodings {
661 for _, c := range testCases {
662 cfg.QueryIngestersWithin = c.queryIngestersWithin
663 t.Run(fmt.Sprintf("thanosEngine=%t,encoding=%s,queryIngestersWithin=%v, test=%s", thanosEngine, encoding.String(), c.queryIngestersWithin, c.name), func(t *testing.T) {
664 var queryEngine promql.QueryEngine

Callers

nothing calls this directly

Calls 14

NewOverridesFunction · 0.92
makeMockChunkStoreFunction · 0.85
DefaultLimitsConfigFunction · 0.85
UseAlwaysQueryableFunction · 0.85
NewMockStoreQueryableFunction · 0.85
NewRangeQueryMethod · 0.80
NewFunction · 0.70
RunMethod · 0.65
StringMethod · 0.65
ExecMethod · 0.65
EqualMethod · 0.65
WrapMethod · 0.65

Tested by

no test coverage detected