Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions integration/e2e/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,12 @@ func (s *ConcreteService) Stop() error {

s.Wait()

// Ensure the container is fully removed before returning. Even though
// containers are started with --rm, Docker removes them asynchronously
// after the process exits. Without this explicit removal, restarting a
// container with the same name can fail with "name already in use".
_, _ = RunCommandAndGetOutput("docker", "rm", "--force", s.containerName())

s.usedNetworkName = ""

return nil
Expand All @@ -181,6 +187,12 @@ func (s *ConcreteService) Kill() error {

s.Wait()

// Ensure the container is fully removed before returning. Even though
// containers are started with --rm, Docker removes them asynchronously
// after the process exits. Without this explicit removal, restarting a
// container with the same name can fail with "name already in use".
_, _ = RunCommandAndGetOutput("docker", "rm", "--force", s.containerName())

s.usedNetworkName = ""

return nil
Expand Down
20 changes: 13 additions & 7 deletions integration/ingester_metadata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,21 @@ func TestIngesterMetadataWithTenantFederation(t *testing.T) {
querier := e2ecortex.NewQuerier("querier", e2ecortex.RingStoreConsul, consul.NetworkHTTPEndpoint(), flags, "")
require.NoError(t, s.StartAndWaitReady(distributor, ingester, querier))

// Wait until distributor has updated the ring.
require.NoError(t, distributor.WaitSumMetricsWithOptions(e2e.Equals(1), []string{"cortex_ring_members"}, e2e.WithLabelMatchers(
labels.MustNewMatcher(labels.MatchEqual, "name", "ingester"),
labels.MustNewMatcher(labels.MatchEqual, "state", "ACTIVE"))))
// Wait until distributor has updated the ring. Use WaitMissingMetrics because
// with tenant federation enabled, the metrics endpoint may take longer to expose
// ring metrics after startup.
require.NoError(t, distributor.WaitSumMetricsWithOptions(e2e.Equals(1), []string{"cortex_ring_members"},
e2e.WithLabelMatchers(
labels.MustNewMatcher(labels.MatchEqual, "name", "ingester"),
labels.MustNewMatcher(labels.MatchEqual, "state", "ACTIVE")),
e2e.WaitMissingMetrics))

// Wait until querier has updated the ring.
require.NoError(t, querier.WaitSumMetricsWithOptions(e2e.Equals(1), []string{"cortex_ring_members"}, e2e.WithLabelMatchers(
labels.MustNewMatcher(labels.MatchEqual, "name", "ingester"),
labels.MustNewMatcher(labels.MatchEqual, "state", "ACTIVE"))))
require.NoError(t, querier.WaitSumMetricsWithOptions(e2e.Equals(1), []string{"cortex_ring_members"},
e2e.WithLabelMatchers(
labels.MustNewMatcher(labels.MatchEqual, "name", "ingester"),
labels.MustNewMatcher(labels.MatchEqual, "state", "ACTIVE")),
e2e.WaitMissingMetrics))

metadataMetricNum := 5
metadataPerMetrics := 2
Expand Down
7 changes: 7 additions & 0 deletions integration/querier_microservices_mode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,13 @@ func TestQuerierWithBlocksStorageRunningInMicroservicesMode(t *testing.T) {
case "parquet":
// Wait until the parquet-converter convert blocks
require.NoError(t, parquetConverter.WaitSumMetricsWithOptions(e2e.Equals(float64(2)), []string{"cortex_parquet_converter_blocks_converted_total"}, e2e.WaitMissingMetrics))

// Wait until the compactor's blocks cleaner has completed at least
// one pass, which creates the bucket index. The parquet
// store-gateway discovers blocks on-demand through the bucket index
// rather than pre-loading them, so the bucket index must exist
// before querying.
require.NoError(t, compactor.WaitSumMetricsWithOptions(e2e.Greater(0), []string{"cortex_compactor_block_cleanup_completed_total"}, e2e.WaitMissingMetrics))
}

// Query back the series (1 only in the storage, 1 only in the ingesters, 1 on both).
Expand Down
7 changes: 7 additions & 0 deletions integration/querier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,13 @@ func TestQuerierWithBlocksStorageRunningInSingleBinaryMode(t *testing.T) {
case "parquet":
// Wait until the parquet-converter convert blocks
require.NoError(t, parquetConverter.WaitSumMetrics(e2e.Equals(float64(2*cluster.NumInstances())), "cortex_parquet_converter_blocks_converted_total"))

// Wait until the compactor's blocks cleaner has completed at least
// one pass, which creates the bucket index. The parquet
// store-gateway discovers blocks on-demand through the bucket index
// rather than pre-loading them, so the bucket index must exist
// before querying.
require.NoError(t, cluster.WaitSumMetricsWithOptions(e2e.Greater(0), []string{"cortex_compactor_block_cleanup_completed_total"}, e2e.WaitMissingMetrics))
}

// Query back the series (1 only in the storage, 1 only in the ingesters, 1 on both).
Expand Down
32 changes: 26 additions & 6 deletions integration/query_fuzz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1824,22 +1824,42 @@ func shouldUseSampleNumComparer(query string) bool {
return false
}

func isValidQuery(generatedQuery parser.Expr, skipStdAggregations bool) bool {
func isValidQuery(generatedQuery parser.Expr, skipBackwardIncompat bool) bool {
isValid := true
queryStr := generatedQuery.String()
// TODO(SungJin1212): Test limitk, limit_ratio
if strings.Contains(generatedQuery.String(), "limitk") {
if strings.Contains(queryStr, "limitk") {
// current skip the limitk
return false
}
if strings.Contains(generatedQuery.String(), "limit_ratio") {
if strings.Contains(queryStr, "limit_ratio") {
// current skip the limit_ratio
return false
}
if skipStdAggregations && (strings.Contains(generatedQuery.String(), "stddev") || strings.Contains(generatedQuery.String(), "stdvar")) {
// The behavior of stdvar and stddev changes in https://github.com/prometheus/prometheus/pull/14941
// If skipStdAggregations enabled, we skip to evaluate for stddev and stdvar aggregations.
if strings.Contains(queryStr, "--") {
// The query fuzzer can generate nested unary negation operators (e.g. --0.5)
// which are evaluated differently between Cortex versions. Skip these queries
// to avoid false positives in backward compatibility tests.
return false
}
if skipBackwardIncompat {
// Skip functions and aggregations whose evaluation semantics changed across
// Prometheus versions embedded in different Cortex releases. These produce
// legitimately different results and are not Cortex bugs.
if strings.Contains(queryStr, "stddev") || strings.Contains(queryStr, "stdvar") {
// Changed in https://github.com/prometheus/prometheus/pull/14941
return false
}
if strings.Contains(queryStr, "quantile") {
return false
}
if strings.Contains(queryStr, "predict_linear") {
return false
}
if strings.Contains(queryStr, "atan2") {
return false
}
}
return isValid
}

Expand Down
Loading