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

Function TestIngesterGlobalLimits

integration/ingester_limits_test.go:22–136  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

20)
21
22func TestIngesterGlobalLimits(t *testing.T) {
23 tests := map[string]struct {
24 shardingStrategy string
25 tenantShardSize int
26 maxGlobalSeriesPerTenant int
27 maxGlobalSeriesPerMetric int
28 }{
29 "default sharding strategy": {
30 shardingStrategy: "default",
31 tenantShardSize: 1, // Ignored by default strategy.
32 maxGlobalSeriesPerTenant: 1000,
33 maxGlobalSeriesPerMetric: 300,
34 },
35 "shuffle sharding strategy": {
36 shardingStrategy: "shuffle-sharding",
37 tenantShardSize: 1,
38 maxGlobalSeriesPerTenant: 1000,
39 maxGlobalSeriesPerMetric: 300,
40 },
41 }
42
43 for testName, testData := range tests {
44 t.Run(testName, func(t *testing.T) {
45 s, err := e2e.NewScenario(networkName)
46 require.NoError(t, err)
47 defer s.Close()
48
49 flags := BlocksStorageFlags()
50 flags["-distributor.replication-factor"] = "1"
51 flags["-distributor.shard-by-all-labels"] = "true"
52 flags["-distributor.sharding-strategy"] = testData.shardingStrategy
53 flags["-distributor.ingestion-tenant-shard-size"] = strconv.Itoa(testData.tenantShardSize)
54 flags["-ingester.max-series-per-user"] = "0"
55 flags["-ingester.max-series-per-metric"] = "0"
56 flags["-ingester.max-global-series-per-user"] = strconv.Itoa(testData.maxGlobalSeriesPerTenant)
57 flags["-ingester.max-global-series-per-metric"] = strconv.Itoa(testData.maxGlobalSeriesPerMetric)
58 flags["-ingester.heartbeat-period"] = "1s"
59
60 // Start dependencies.
61 consul := e2edb.NewConsul()
62 minio := e2edb.NewMinio(9000, flags["-blocks-storage.s3.bucket-name"])
63 require.NoError(t, s.StartAndWaitReady(consul, minio))
64
65 // Start Cortex components.
66 distributor := e2ecortex.NewDistributor("distributor", e2ecortex.RingStoreConsul, consul.NetworkHTTPEndpoint(), flags, "")
67 ingester1 := e2ecortex.NewIngester("ingester-1", e2ecortex.RingStoreConsul, consul.NetworkHTTPEndpoint(), flags, "")
68 ingester2 := e2ecortex.NewIngester("ingester-2", e2ecortex.RingStoreConsul, consul.NetworkHTTPEndpoint(), flags, "")
69 ingester3 := e2ecortex.NewIngester("ingester-3", e2ecortex.RingStoreConsul, consul.NetworkHTTPEndpoint(), flags, "")
70 require.NoError(t, s.StartAndWaitReady(distributor, ingester1, ingester2, ingester3))
71
72 // Wait until distributor has updated the ring.
73 require.NoError(t, distributor.WaitSumMetricsWithOptions(e2e.Equals(3), []string{"cortex_ring_members"}, e2e.WithLabelMatchers(
74 labels.MustNewMatcher(labels.MatchEqual, "name", "ingester"),
75 labels.MustNewMatcher(labels.MatchEqual, "state", "ACTIVE"))))
76
77 // Wait until ingesters have heartbeated the ring after all ingesters were active,
78 // in order to update the number of instances. Since we have no metric, we have to
79 // rely on a ugly sleep.

Callers

nothing calls this directly

Calls 14

CloseMethod · 0.95
StartAndWaitReadyMethod · 0.95
PushMethod · 0.95
NewScenarioFunction · 0.92
NewDistributorFunction · 0.92
NewIngesterFunction · 0.92
EqualsFunction · 0.92
WithLabelMatchersFunction · 0.92
NewClientFunction · 0.92
NetworkHTTPEndpointMethod · 0.80
HTTPEndpointMethod · 0.80

Tested by

no test coverage detected