Skip to content

Commit

Permalink
Fix test asserts
Browse files Browse the repository at this point in the history
Follow-up to prometheus/client_golang#1424

Signed-off-by: György Krajcsovits <[email protected]>
  • Loading branch information
krajorama committed Aug 30, 2024
1 parent 062571c commit fa0d03b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pkg/querier/tenantfederation/merge_queryable_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -900,7 +900,7 @@ func TestMergeQueryable_LabelValues(t *testing.T) {
} else {
require.NoError(t, err)
assert.Equal(t, tc.expectedLabelValues, actLabelValues, fmt.Sprintf("unexpected values for label '%s'", tc.labelName))
assert.NoError(t, testutil.GatherAndCompare(reg, strings.NewReader(tc.expectedMetrics), "cortex_querier_federation_sample_tenants_queried"))
assert.NoError(t, testutil.GatherAndCompare(reg, strings.NewReader(tc.expectedMetrics), "cortex_querier_federation_tenants_queried"))
assertEqualWarnings(t, tc.expectedWarnings, warnings)
}
})
Expand Down
6 changes: 4 additions & 2 deletions pkg/storage/ingest/partition_offset_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -409,9 +409,11 @@ func TestPartitionOffsetClient_FetchPartitionsLastProducedOffsets(t *testing.T)
require.NoError(t, err)
assert.Empty(t, offsets)

assert.NoError(t, promtest.GatherAndCompare(reg, strings.NewReader(""),
assert.ErrorContains(t, promtest.GatherAndCompare(reg, strings.NewReader(""),
"cortex_ingest_storage_reader_last_produced_offset_requests_total",
"cortex_ingest_storage_reader_last_produced_offset_failures_total"))
"cortex_ingest_storage_reader_last_produced_offset_failures_total"),
"expected metric name(s) not found",
)
})

t.Run("should honor context deadline and not fail other in-flight requests issued while the canceled one was still running", func(t *testing.T) {
Expand Down
7 changes: 6 additions & 1 deletion pkg/streamingpromql/compat/fallback_engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,12 @@ func TestEngineWithFallback(t *testing.T) {
# HELP cortex_mimir_query_engine_supported_queries_total Total number of queries that were supported by the Mimir query engine.
# TYPE cortex_mimir_query_engine_supported_queries_total counter
cortex_mimir_query_engine_supported_queries_total 1
`), "cortex_mimir_query_engine_supported_queries_total", "cortex_mimir_query_engine_unsupported_queries_total"))
`), "cortex_mimir_query_engine_supported_queries_total"))

require.ErrorContains(t, promtest.GatherAndCompare(reg, strings.NewReader(""),
"cortex_mimir_query_engine_unsupported_queries_total"),
"expected metric name(s) not found",
)
})

t.Run("should fall back for unsupported expressions", func(t *testing.T) {
Expand Down

0 comments on commit fa0d03b

Please sign in to comment.