Skip to content

Commit

Permalink
fix(internal/telemetry/telemetrytest): initialize MockClient#Metrics map
Browse files Browse the repository at this point in the history
  • Loading branch information
darccio committed Dec 12, 2024
1 parent ecf23b8 commit d5f955b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions internal/telemetry/telemetrytest/telemetrytest.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ func (c *MockClient) Record(ns telemetry.Namespace, _ telemetry.MetricKind, name
c.On("Gauge", ns, name, val, tags, common).Return()
c.On("Record", ns, name, val, tags, common).Return()
_ = c.Called(ns, name, val, tags, common)
if len(c.Metrics) == 0 {
c.Metrics = make(map[telemetry.Namespace]map[string]float64)
}
// record the val for tests that assert based on the value
if _, ok := c.Metrics[ns]; !ok {
c.Metrics[ns] = map[string]float64{}
Expand Down

0 comments on commit d5f955b

Please sign in to comment.