mirror of
https://github.com/cloudflare/cloudflared.git
synced 2025-07-27 13:29:58 +00:00
TUN-528: Move cloudflared into a separate repo
This commit is contained in:
24
metrics/timer_test.go
Normal file
24
metrics/timer_test.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package metrics
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestEnd(t *testing.T) {
|
||||
m := prometheus.NewHistogramVec(
|
||||
prometheus.HistogramOpts{
|
||||
Namespace: "TestCallLatencyWithoutMeasurement",
|
||||
Name: "Latency",
|
||||
Buckets: prometheus.LinearBuckets(0, 50, 100),
|
||||
},
|
||||
[]string{"key"},
|
||||
)
|
||||
timer := NewTimer(m, time.Millisecond, "key")
|
||||
assert.Equal(t, time.Duration(0), timer.End("dne"))
|
||||
timer.Start("test")
|
||||
assert.NotEqual(t, time.Duration(0), timer.End("test"))
|
||||
}
|
Reference in New Issue
Block a user