(t *testing.T)
| 170 | } |
| 171 | |
| 172 | func (s) TestUpDownCounts(t *testing.T) { |
| 173 | cleanup := snapshotMetricsRegistryForTesting() |
| 174 | defer cleanup() |
| 175 | |
| 176 | intUpDownCountHandle1 := RegisterInt64UpDownCount(MetricDescriptor{ |
| 177 | Name: "simple up down counter", |
| 178 | Description: "current number of emissions from tests", |
| 179 | Unit: "int", |
| 180 | Labels: []string{"int up down counter label"}, |
| 181 | OptionalLabels: []string{"int up down counter optional label"}, |
| 182 | Default: false, |
| 183 | }) |
| 184 | |
| 185 | fmr := newFakeMetricsRecorder(t) |
| 186 | intUpDownCountHandle1.Record(fmr, 2, []string{"up down value", "some optional label value"}...) |
| 187 | intUpDownCountHandle1.Record(fmr, -1, []string{"up down value", "some optional label value"}...) |
| 188 | |
| 189 | if got := fmr.intValues[intUpDownCountHandle1.Descriptor()]; got != 1 { |
| 190 | t.Fatalf("fmr.intValues[intUpDownCountHandle1.MetricDescriptor] got %v, want: %v", got, 1) |
| 191 | } |
| 192 | } |
| 193 | |
| 194 | // TestNumerousIntCounts tests numerous int count metrics registered onto the |
| 195 | // metric registry. A component (simulated by test) should be able to record on |
nothing calls this directly
no test coverage detected