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

Function TestRulerDisablesRuleGroups

integration/ruler_test.go:1346–1465  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1344}
1345
1346func TestRulerDisablesRuleGroups(t *testing.T) {
1347 s, err := e2e.NewScenario(networkName)
1348 require.NoError(t, err)
1349 defer s.Close()
1350
1351 // Start dependencies.
1352 consul := e2edb.NewConsul()
1353 minio := e2edb.NewMinio(9000, bucketName, rulestoreBucketName)
1354 require.NoError(t, s.StartAndWaitReady(consul, minio))
1355
1356 const blockRangePeriod = 2 * time.Second
1357 // Configure the ruler.
1358 flags := mergeFlags(
1359 BlocksStorageFlags(),
1360 RulerFlags(),
1361 map[string]string{
1362 "-blocks-storage.tsdb.block-ranges-period": blockRangePeriod.String(),
1363 "-blocks-storage.tsdb.ship-interval": "1s",
1364 "-blocks-storage.bucket-store.sync-interval": "1s",
1365 "-blocks-storage.bucket-store.index-cache.backend": tsdb.IndexCacheBackendInMemory,
1366 "-blocks-storage.tsdb.retention-period": ((blockRangePeriod * 2) - 1).String(),
1367
1368 // Enable the bucket index so we can skip the initial bucket scan.
1369 "-blocks-storage.bucket-store.bucket-index.enabled": "false",
1370 // Evaluate rules often, so that we don't need to wait for metrics to show up.
1371 "-ruler.evaluation-interval": "2s",
1372 "-ruler.poll-interval": "2s",
1373 // No delay
1374 "-ruler.evaluation-delay-duration": "0",
1375
1376 // We run single ingester only, no replication.
1377 "-distributor.replication-factor": "1",
1378
1379 // Very low limit so that ruler hits it.
1380 "-querier.max-fetched-chunks-per-query": "15",
1381 "-querier.query-store-after": (1 * time.Second).String(),
1382 "-querier.query-ingesters-within": (2 * time.Second).String(),
1383 },
1384 )
1385
1386 const namespace = "test"
1387 const user = "user"
1388 configFileName := "runtime-config.yaml"
1389 bucketName := "cortex"
1390
1391 storeGateway := e2ecortex.NewStoreGateway("store-gateway-1", e2ecortex.RingStoreConsul, consul.NetworkHTTPEndpoint(), flags, "")
1392
1393 flags = mergeFlags(flags, map[string]string{
1394 "-querier.store-gateway-addresses": storeGateway.NetworkGRPCEndpoint(),
1395 "-runtime-config.backend": "s3",
1396 "-runtime-config.s3.access-key-id": e2edb.MinioAccessKey,
1397 "-runtime-config.s3.secret-access-key": e2edb.MinioSecretKey,
1398 "-runtime-config.s3.bucket-name": bucketName,
1399 "-runtime-config.s3.endpoint": fmt.Sprintf("%s-minio-9000:9000", networkName),
1400 "-runtime-config.s3.insecure": "true",
1401 "-runtime-config.file": configFileName,
1402 "-runtime-config.reload-period": "2s",
1403 })

Callers

nothing calls this directly

Calls 15

CloseMethod · 0.95
StartAndWaitReadyMethod · 0.95
SetRuleGroupMethod · 0.95
GetPrometheusRulesMethod · 0.95
NewScenarioFunction · 0.92
NewStoreGatewayFunction · 0.92
NewDistributorFunction · 0.92
NewRulerFunction · 0.92
NewIngesterFunction · 0.92
EqualsFunction · 0.92
NewClientFunction · 0.92
GreaterOrEqualFunction · 0.92

Tested by

no test coverage detected