Skip to content

Commit

Permalink
In prometheus/client_golang#1424, a new check was introduced to make …
Browse files Browse the repository at this point in the history
…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]>
  • Loading branch information
inteon committed Aug 23, 2024
1 parent 5821ede commit d140d14
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions pkg/metrics/certificates_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -363,16 +363,10 @@ func TestCertificateCache(t *testing.T) {
Namespace: "default-unit-test-ns",
Name: "crt3",
})
if err := testutil.CollectAndCompare(m.certificateReadyStatus,
strings.NewReader(readyMetadata),
"certmanager_certificate_ready_status",
); err != nil {
t.Errorf("unexpected collecting result:\n%s", err)
if testutil.CollectAndCount(m.certificateReadyStatus, "certmanager_certificate_ready_status") != 0 {
t.Errorf("unexpected collecting result")
}
if err := testutil.CollectAndCompare(m.certificateExpiryTimeSeconds,
strings.NewReader(expiryMetadata),
"certmanager_certificate_expiration_timestamp_seconds",
); err != nil {
t.Errorf("unexpected collecting result:\n%s", err)
if testutil.CollectAndCount(m.certificateExpiryTimeSeconds, "certmanager_certificate_expiration_timestamp_seconds") != 0 {
t.Errorf("unexpected collecting result")
}
}

0 comments on commit d140d14

Please sign in to comment.