-
Notifications
You must be signed in to change notification settings - Fork 20
/
metrics_test.go
34 lines (27 loc) · 1.13 KB
/
metrics_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// SPDX-FileCopyrightText: 2021 Comcast Cable Communications Management, LLC
// SPDX-License-Identifier: Apache-2.0
package main
// Using Caduceus's test suite:
//
// If you are testing a new metric the followng process needs to be done below:
// 1. Create a fake, mockMetric i.e fakeEventType := new(mockCounter)
// 2. If your metric type has yet to be included in mockCaduceusMetricRegistry within mocks.go
// add your metric type to mockCaduceusMetricRegistry
// 3. Trigger the On method on that "mockMetric" with various different cases of that metric,
// in both senderWrapper_test.go and/or outboundSender_test.go
// i.e:
// case 1: On("With", []string{"event", iot}
// case 2: On("With", []string{"event", unknown}
// Tests for all possible event_types that will be sent to the metrics Desc. If all cases arn't
// included tests will fail.
// 4. Mimic the metric behavior using On i.e if your specific metric is a counter:
// fakeSlow.On("Add", 1.0).Return()
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestMetrics(t *testing.T) {
assert := assert.New(t)
m := Metrics()
assert.NotNil(m)
}