cloudflare/cloudflared

Public

mirrored from https://github.com/cloudflare/cloudflaredAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
2018.9.0

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

metrics/timer_test.go

24lines · modecode

1package metrics
2
3import (
4 "testing"
5 "time"
6
7 "github.com/prometheus/client_golang/prometheus"
8 "github.com/stretchr/testify/assert"
9)
10
11func TestEnd(t *testing.T) {
12 m := prometheus.NewHistogramVec(
13 prometheus.HistogramOpts{
14 Namespace: "TestCallLatencyWithoutMeasurement",
15 Name: "Latency",
16 Buckets: prometheus.LinearBuckets(0, 50, 100),
17 },
18 []string{"key"},
19 )
20 timer := NewTimer(m, time.Millisecond, "key")
21 assert.Equal(t, time.Duration(0), timer.End("dne"))
22 timer.Start("test")
23 assert.NotEqual(t, time.Duration(0), timer.End("test"))
24}