Skip to content

Commit fa0d03b

Browse files
committed
Fix test asserts
Follow-up to prometheus/client_golang#1424 Signed-off-by: György Krajcsovits <[email protected]>
1 parent 062571c commit fa0d03b

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

pkg/querier/tenantfederation/merge_queryable_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -900,7 +900,7 @@ func TestMergeQueryable_LabelValues(t *testing.T) {
900900
} else {
901901
require.NoError(t, err)
902902
assert.Equal(t, tc.expectedLabelValues, actLabelValues, fmt.Sprintf("unexpected values for label '%s'", tc.labelName))
903-
assert.NoError(t, testutil.GatherAndCompare(reg, strings.NewReader(tc.expectedMetrics), "cortex_querier_federation_sample_tenants_queried"))
903+
assert.NoError(t, testutil.GatherAndCompare(reg, strings.NewReader(tc.expectedMetrics), "cortex_querier_federation_tenants_queried"))
904904
assertEqualWarnings(t, tc.expectedWarnings, warnings)
905905
}
906906
})

pkg/storage/ingest/partition_offset_client_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,9 +409,11 @@ func TestPartitionOffsetClient_FetchPartitionsLastProducedOffsets(t *testing.T)
409409
require.NoError(t, err)
410410
assert.Empty(t, offsets)
411411

412-
assert.NoError(t, promtest.GatherAndCompare(reg, strings.NewReader(""),
412+
assert.ErrorContains(t, promtest.GatherAndCompare(reg, strings.NewReader(""),
413413
"cortex_ingest_storage_reader_last_produced_offset_requests_total",
414-
"cortex_ingest_storage_reader_last_produced_offset_failures_total"))
414+
"cortex_ingest_storage_reader_last_produced_offset_failures_total"),
415+
"expected metric name(s) not found",
416+
)
415417
})
416418

417419
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) {

pkg/streamingpromql/compat/fallback_engine_test.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,12 @@ func TestEngineWithFallback(t *testing.T) {
4949
# HELP cortex_mimir_query_engine_supported_queries_total Total number of queries that were supported by the Mimir query engine.
5050
# TYPE cortex_mimir_query_engine_supported_queries_total counter
5151
cortex_mimir_query_engine_supported_queries_total 1
52-
`), "cortex_mimir_query_engine_supported_queries_total", "cortex_mimir_query_engine_unsupported_queries_total"))
52+
`), "cortex_mimir_query_engine_supported_queries_total"))
53+
54+
require.ErrorContains(t, promtest.GatherAndCompare(reg, strings.NewReader(""),
55+
"cortex_mimir_query_engine_unsupported_queries_total"),
56+
"expected metric name(s) not found",
57+
)
5358
})
5459

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

0 commit comments

Comments
 (0)