(t *testing.T)
| 44 | } |
| 45 | |
| 46 | func TestWrapRegisterer(t *testing.T) { |
| 47 | now := time.Now() |
| 48 | nowFn := func() time.Time { return now } |
| 49 | simpleCnt := NewCounter(CounterOpts{ |
| 50 | Name: "simpleCnt", |
| 51 | Help: "helpSimpleCnt", |
| 52 | now: nowFn, |
| 53 | }) |
| 54 | simpleCnt.Inc() |
| 55 | |
| 56 | simpleGge := NewGauge(GaugeOpts{ |
| 57 | Name: "simpleGge", |
| 58 | Help: "helpSimpleGge", |
| 59 | }) |
| 60 | simpleGge.Set(3.14) |
| 61 | |
| 62 | preCnt := NewCounter(CounterOpts{ |
| 63 | Name: "pre_simpleCnt", |
| 64 | Help: "helpSimpleCnt", |
| 65 | now: nowFn, |
| 66 | }) |
| 67 | preCnt.Inc() |
| 68 | |
| 69 | barLabeledCnt := NewCounter(CounterOpts{ |
| 70 | Name: "simpleCnt", |
| 71 | Help: "helpSimpleCnt", |
| 72 | ConstLabels: Labels{"foo": "bar"}, |
| 73 | now: nowFn, |
| 74 | }) |
| 75 | barLabeledCnt.Inc() |
| 76 | |
| 77 | bazLabeledCnt := NewCounter(CounterOpts{ |
| 78 | Name: "simpleCnt", |
| 79 | Help: "helpSimpleCnt", |
| 80 | ConstLabels: Labels{"foo": "baz"}, |
| 81 | now: nowFn, |
| 82 | }) |
| 83 | bazLabeledCnt.Inc() |
| 84 | |
| 85 | labeledPreCnt := NewCounter(CounterOpts{ |
| 86 | Name: "pre_simpleCnt", |
| 87 | Help: "helpSimpleCnt", |
| 88 | ConstLabels: Labels{"foo": "bar"}, |
| 89 | now: nowFn, |
| 90 | }) |
| 91 | labeledPreCnt.Inc() |
| 92 | |
| 93 | twiceLabeledPreCnt := NewCounter(CounterOpts{ |
| 94 | Name: "pre_simpleCnt", |
| 95 | Help: "helpSimpleCnt", |
| 96 | ConstLabels: Labels{"foo": "bar", "dings": "bums"}, |
| 97 | now: nowFn, |
| 98 | }) |
| 99 | twiceLabeledPreCnt.Inc() |
| 100 | |
| 101 | barLabeledUncheckedCollector := uncheckedCollector{barLabeledCnt} |
| 102 | |
| 103 | scenarios := map[string]struct { |
nothing calls this directly
no test coverage detected