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

Function TestBackwardCompatibilityQueryFuzz

integration/query_fuzz_test.go:1484–1601  ·  view source on GitHub ↗

TestBackwardCompatibilityQueryFuzz compares query results with the latest Cortex release.

(t *testing.T)

Source from the content-addressed store, hash-verified

1482
1483// TestBackwardCompatibilityQueryFuzz compares query results with the latest Cortex release.
1484func TestBackwardCompatibilityQueryFuzz(t *testing.T) {
1485 // TODO: expose the image tag to be passed from Makefile or Github Action Config.
1486 previousCortexReleaseImage := "quay.io/cortexproject/cortex:v1.18.1"
1487 s, err := e2e.NewScenario(networkName)
1488 require.NoError(t, err)
1489 defer s.Close()
1490
1491 // Start dependencies.
1492 consul1 := e2edb.NewConsulWithName("consul1")
1493 consul2 := e2edb.NewConsulWithName("consul2")
1494 require.NoError(t, s.StartAndWaitReady(consul1, consul2))
1495
1496 flags := mergeFlags(
1497 AlertmanagerLocalFlags(),
1498 map[string]string{
1499 "-store.engine": blocksStorageEngine,
1500 "-blocks-storage.backend": "filesystem",
1501 "-blocks-storage.tsdb.head-compaction-interval": "4m",
1502 "-blocks-storage.tsdb.block-ranges-period": "2h",
1503 "-blocks-storage.tsdb.ship-interval": "1h",
1504 "-blocks-storage.bucket-store.sync-interval": "15m",
1505 "-blocks-storage.tsdb.retention-period": "2h",
1506 "-blocks-storage.bucket-store.index-cache.backend": tsdb.IndexCacheBackendInMemory,
1507 // Ingester.
1508 "-ring.store": "consul",
1509 "-consul.hostname": consul1.NetworkHTTPEndpoint(),
1510 // Distributor.
1511 "-distributor.replication-factor": "1",
1512 // Store-gateway.
1513 "-store-gateway.sharding-enabled": "false",
1514 // alert manager
1515 "-alertmanager.web.external-url": "http://localhost/alertmanager",
1516 "-frontend.query-vertical-shard-size": "2",
1517 "-frontend.max-cache-freshness": "1m",
1518 },
1519 )
1520 // make alert manager config dir
1521 require.NoError(t, writeFileToSharedDir(s, "alertmanager_configs", []byte{}))
1522
1523 path1 := path.Join(s.SharedDir(), "cortex-1")
1524 path2 := path.Join(s.SharedDir(), "cortex-2")
1525
1526 flags1 := mergeFlags(flags, map[string]string{"-blocks-storage.filesystem.dir": path1})
1527 // Start Cortex replicas.
1528 cortex1 := e2ecortex.NewSingleBinary("cortex-1", flags1, "")
1529 flags2 := mergeFlags(flags, map[string]string{
1530 "-blocks-storage.filesystem.dir": path2,
1531 "-consul.hostname": consul2.NetworkHTTPEndpoint(),
1532 })
1533 cortex2 := e2ecortex.NewSingleBinary("cortex-2", flags2, previousCortexReleaseImage)
1534 require.NoError(t, s.StartAndWaitReady(cortex1, cortex2))
1535
1536 // Wait until Cortex replicas have updated the ring state.
1537 require.NoError(t, cortex1.WaitSumMetrics(e2e.Equals(float64(512)), "cortex_ring_tokens_total"))
1538 require.NoError(t, cortex2.WaitSumMetrics(e2e.Equals(float64(512)), "cortex_ring_tokens_total"))
1539
1540 c1, err := e2ecortex.NewClient(cortex1.HTTPEndpoint(), cortex1.HTTPEndpoint(), "", "", "user-1")
1541 require.NoError(t, err)

Callers

nothing calls this directly

Calls 15

CloseMethod · 0.95
StartAndWaitReadyMethod · 0.95
SharedDirMethod · 0.95
PushMethod · 0.95
NewScenarioFunction · 0.92
NewSingleBinaryFunction · 0.92
EqualsFunction · 0.92
NewClientFunction · 0.92
writeFileToSharedDirFunction · 0.85
waitUntilReadyFunction · 0.85
runQueryFuzzTestCasesFunction · 0.85

Tested by

no test coverage detected