Skip to content

Commit

Permalink
reverted unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
anurag4DSB committed Dec 24, 2024
1 parent a182f58 commit 3edcb50
Showing 1 changed file with 0 additions and 33 deletions.
33 changes: 0 additions & 33 deletions pkg/clients/iam/iam_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@ import (
"github.com/aws/aws-sdk-go-v2/service/iam/types"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/prometheus/client_golang/prometheus"

"github.com/aws/smithy-go"
iamclient "github.com/scality/cosi-driver/pkg/clients/iam"
"github.com/scality/cosi-driver/pkg/metrics"
"github.com/scality/cosi-driver/pkg/mock"
"github.com/scality/cosi-driver/pkg/util"
)
Expand Down Expand Up @@ -477,34 +475,3 @@ var _ = Describe("IAMClient", func() {
})
})
})

var _ = Describe("AnuragMetrics", func() {
var (
mockRegistry *prometheus.Registry
)

BeforeEach(func() {
// Initialize a new Prometheus registry for testing
mockRegistry = prometheus.NewRegistry()
})

It("should increment and observe metrics", func() {
metrics.InitializeMetrics("test_prefix", mockRegistry)

metrics.S3RequestsTotal.WithLabelValues("GET", "200").Inc()
metrics.S3RequestDuration.WithLabelValues("GET", "200").Observe(0.123)

metricFamilies, err := mockRegistry.Gather()
Expect(err).NotTo(HaveOccurred())

for _, mf := range metricFamilies {
if mf.GetName() == "test_prefix_s3_requests_total" {
Expect(mf.Metric[0].GetCounter().GetValue()).To(Equal(1.0))
}

if mf.GetName() == "test_prefix_s3_request_duration_seconds" {
Expect(mf.Metric[0].GetHistogram().GetSampleCount()).To(Equal(uint64(1)))
}
}
})
})

0 comments on commit 3edcb50

Please sign in to comment.