MCPcopy Create free account
hub / github.com/prometheus/common / TestHideHTTPClientConfigSecrets

Function TestHideHTTPClientConfigSecrets

config/http_config_test.go:1368–1379  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1366}
1367
1368func TestHideHTTPClientConfigSecrets(t *testing.T) {
1369 c, _, err := LoadHTTPConfigFile("testdata/http.conf.good.yml")
1370 if err != nil {
1371 t.Errorf("Error parsing %s: %s", "testdata/http.conf.good.yml", err)
1372 }
1373
1374 // String method must not reveal authentication credentials.
1375 s := c.String()
1376 if strings.Contains(s, "mysecret") {
1377 t.Fatal("http client config's String method reveals authentication credentials.")
1378 }
1379}
1380
1381func TestDefaultFollowRedirect(t *testing.T) {
1382 cfg, _, err := LoadHTTPConfigFile("testdata/http.conf.good.yml")

Callers

nothing calls this directly

Calls 2

LoadHTTPConfigFileFunction · 0.85
StringMethod · 0.65

Tested by

no test coverage detected