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

Function TestSlowQueries

pkg/distributor/distributor_test.go:2781–2810  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

2779}
2780
2781func TestSlowQueries(t *testing.T) {
2782 t.Parallel()
2783 ctx := user.InjectOrgID(context.Background(), "user")
2784 nameMatcher := mustEqualMatcher(model.MetricNameLabel, "foo")
2785 nIngesters := 3
2786 for _, shardByAllLabels := range []bool{true, false} {
2787 for happy := 0; happy <= nIngesters; happy++ {
2788 shardByAllLabels := shardByAllLabels
2789 happy := happy
2790 t.Run(fmt.Sprintf("%t/%d", shardByAllLabels, happy), func(t *testing.T) {
2791 t.Parallel()
2792 var expectedErr error
2793 if nIngesters-happy > 1 {
2794 expectedErr = errFail
2795 }
2796
2797 ds, _, _, _ := prepare(t, prepConfig{
2798 numIngesters: nIngesters,
2799 happyIngesters: happy,
2800 numDistributors: 1,
2801 queryDelay: 100 * time.Millisecond,
2802 shardByAllLabels: shardByAllLabels,
2803 })
2804
2805 _, err := ds[0].QueryStream(ctx, 0, 10, false, nameMatcher)
2806 assert.Equal(t, expectedErr, err)
2807 })
2808 }
2809 }
2810}
2811
2812func TestDistributor_MetricsForLabelMatchers_SingleSlowIngester(t *testing.T) {
2813 t.Parallel()

Callers

nothing calls this directly

Calls 5

mustEqualMatcherFunction · 0.85
prepareFunction · 0.70
RunMethod · 0.65
QueryStreamMethod · 0.65
EqualMethod · 0.65

Tested by

no test coverage detected