(t *testing.T)
| 12 | ) |
| 13 | |
| 14 | func TestDiffCounter(t *testing.T) { |
| 15 | ctr := prometheus.NewCounter(prometheus.CounterOpts{Name: test.RandomString()}) |
| 16 | dc := &diffCounter{previous: 0, counter: ctr} |
| 17 | |
| 18 | dc.addAbsoluteToCounter(5) |
| 19 | require.Equal(t, 5.0, ctrVal(t, ctr)) |
| 20 | |
| 21 | dc.addAbsoluteToCounter(7) |
| 22 | require.Equal(t, 7.0, ctrVal(t, ctr)) |
| 23 | |
| 24 | dc.addAbsoluteToCounter(57) |
| 25 | require.Equal(t, 57.0, ctrVal(t, ctr)) |
| 26 | } |
| 27 | |
| 28 | /* Fails in CI. potentially due to an architectural difference and prom internals. |
| 29 | func TestDiffCounterOverflow(t *testing.T) { |
nothing calls this directly
no test coverage detected