Dep ensure -update (#1912)
* dep ensure -update Signed-off-by: Miek Gieben <miek@miek.nl> * Add new files Signed-off-by: Miek Gieben <miek@miek.nl>
This commit is contained in:
parent
6fe27d99be
commit
9d555ab8d2
1505 changed files with 179032 additions and 208137 deletions
3
vendor/github.com/prometheus/common/config/http_config.go
generated
vendored
3
vendor/github.com/prometheus/common/config/http_config.go
generated
vendored
|
@ -85,9 +85,6 @@ func (c *HTTPClientConfig) Validate() error {
|
|||
if c.BasicAuth != nil && (len(c.BearerToken) > 0 || len(c.BearerTokenFile) > 0) {
|
||||
return fmt.Errorf("at most one of basic_auth, bearer_token & bearer_token_file must be configured")
|
||||
}
|
||||
if c.BasicAuth != nil && c.BasicAuth.Username == "" {
|
||||
return fmt.Errorf("basic_auth requires a username")
|
||||
}
|
||||
if c.BasicAuth != nil && (string(c.BasicAuth.Password) != "" && c.BasicAuth.PasswordFile != "") {
|
||||
return fmt.Errorf("at most one of basic_auth password & password_file must be configured")
|
||||
}
|
||||
|
|
26
vendor/github.com/prometheus/common/config/http_config_test.go
generated
vendored
26
vendor/github.com/prometheus/common/config/http_config_test.go
generated
vendored
|
@ -476,6 +476,32 @@ func TestBasicAuthNoPassword(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestBasicAuthNoUsername(t *testing.T) {
|
||||
cfg, _, err := LoadHTTPConfigFile("testdata/http.conf.basic-auth.no-username.yaml")
|
||||
if err != nil {
|
||||
t.Errorf("Error loading HTTP client config: %v", err)
|
||||
}
|
||||
client, err := NewClientFromConfig(*cfg, "test")
|
||||
if err != nil {
|
||||
t.Errorf("Error creating HTTP Client: %v", err)
|
||||
}
|
||||
|
||||
rt, ok := client.Transport.(*basicAuthRoundTripper)
|
||||
if !ok {
|
||||
t.Fatalf("Error casting to basic auth transport, %v", client.Transport)
|
||||
}
|
||||
|
||||
if rt.username != "" {
|
||||
t.Errorf("Got unexpected username: %s", rt.username)
|
||||
}
|
||||
if string(rt.password) != "secret" {
|
||||
t.Errorf("Unexpected HTTP client password: %s", string(rt.password))
|
||||
}
|
||||
if string(rt.passwordFile) != "" {
|
||||
t.Errorf("Expected empty HTTP client passwordFile: %s", rt.passwordFile)
|
||||
}
|
||||
}
|
||||
|
||||
func TestBasicAuthPasswordFile(t *testing.T) {
|
||||
cfg, _, err := LoadHTTPConfigFile("testdata/http.conf.basic-auth.good.yaml")
|
||||
if err != nil {
|
||||
|
|
2
vendor/github.com/prometheus/common/config/testdata/http.conf.basic-auth.no-username.yaml
generated
vendored
Normal file
2
vendor/github.com/prometheus/common/config/testdata/http.conf.basic-auth.no-username.yaml
generated
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
basic_auth:
|
||||
password: secret
|
Loading…
Add table
Add a link
Reference in a new issue