MCPcopy
hub / github.com/cloudflare/cloudflared / TestSendUrl

Function TestSendUrl

connection/observer_test.go:14–22  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

12)
13
14func TestSendUrl(t *testing.T) {
15 observer := NewObserver(&log, &log)
16
17 observer.SendURL("my-url.com")
18 assert.Equal(t, 1.0, getCounterValue(t, observer.metrics.userHostnamesCounts, "https://my-url.com"))
19
20 observer.SendURL("https://another-long-one.com")
21 assert.Equal(t, 1.0, getCounterValue(t, observer.metrics.userHostnamesCounts, "https://another-long-one.com"))
22}
23
24func getCounterValue(t *testing.T, metric *prometheus.CounterVec, val string) float64 {
25 var m = &dto.Metric{}

Callers

nothing calls this directly

Calls 4

SendURLMethod · 0.95
NewObserverFunction · 0.85
getCounterValueFunction · 0.85
EqualMethod · 0.65

Tested by

no test coverage detected