Skip to content

Commit d140d14

Browse files
committed
In prometheus/client_golang#1424, a new check was introduced to make sure the metric with the provided metricName is found.
We were depending on it not erroring. This PR removes that assumption and instead makes sure the metric does no longer existi using the CollectAndCount function. Signed-off-by: Tim Ramlot <[email protected]>
1 parent 5821ede commit d140d14

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

pkg/metrics/certificates_test.go

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -363,16 +363,10 @@ func TestCertificateCache(t *testing.T) {
363363
Namespace: "default-unit-test-ns",
364364
Name: "crt3",
365365
})
366-
if err := testutil.CollectAndCompare(m.certificateReadyStatus,
367-
strings.NewReader(readyMetadata),
368-
"certmanager_certificate_ready_status",
369-
); err != nil {
370-
t.Errorf("unexpected collecting result:\n%s", err)
366+
if testutil.CollectAndCount(m.certificateReadyStatus, "certmanager_certificate_ready_status") != 0 {
367+
t.Errorf("unexpected collecting result")
371368
}
372-
if err := testutil.CollectAndCompare(m.certificateExpiryTimeSeconds,
373-
strings.NewReader(expiryMetadata),
374-
"certmanager_certificate_expiration_timestamp_seconds",
375-
); err != nil {
376-
t.Errorf("unexpected collecting result:\n%s", err)
369+
if testutil.CollectAndCount(m.certificateExpiryTimeSeconds, "certmanager_certificate_expiration_timestamp_seconds") != 0 {
370+
t.Errorf("unexpected collecting result")
377371
}
378372
}

0 commit comments

Comments
 (0)