MCPcopy
hub / github.com/grafana/dskit / TestIsURL

Function TestIsURL

runtimeconfig/provider_test.go:16–34  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

14)
15
16func TestIsURL(t *testing.T) {
17 tests := []struct {
18 path string
19 want bool
20 }{
21 {"http://example.com/config.yaml", true},
22 {"https://example.com/config.yaml", true},
23 {"HTTP://EXAMPLE.COM/config.yaml", false}, // case-sensitive
24 {"/etc/config.yaml", false},
25 {"config.yaml", false},
26 {"", false},
27 {"ftp://example.com/config.yaml", false},
28 }
29 for _, tt := range tests {
30 t.Run(tt.path, func(t *testing.T) {
31 assert.Equal(t, tt.want, isURL(tt.path))
32 })
33 }
34}
35
36func newTestHTTPProvider(t *testing.T, url string, client *http.Client) (*httpProvider, *prometheus.Registry) {
37 reg := prometheus.NewPedanticRegistry()

Callers

nothing calls this directly

Calls 3

isURLFunction · 0.85
RunMethod · 0.80
EqualMethod · 0.45

Tested by

no test coverage detected