Merge pull request #12811 from slashpai/sd_validate
EC2 SD: Validate HTTP config
This commit is contained in:
commit
92f463a51d
|
@ -1745,6 +1745,10 @@ var expectedErrors = []struct {
|
|||
filename: "ec2_filters_empty_values.bad.yml",
|
||||
errMsg: `EC2 SD configuration filter values cannot be empty`,
|
||||
},
|
||||
{
|
||||
filename: "ec2_token_file.bad.yml",
|
||||
errMsg: `at most one of bearer_token & bearer_token_file must be configured`,
|
||||
},
|
||||
{
|
||||
filename: "section_key_dup.bad.yml",
|
||||
errMsg: "field scrape_configs already set in type config.plain",
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
scrape_configs:
|
||||
- job_name: foo
|
||||
ec2_sd_configs:
|
||||
- region: us-east-1
|
||||
bearer_token: foo
|
||||
bearer_token_file: foo
|
|
@ -129,7 +129,7 @@ func (c *EC2SDConfig) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
|||
return errors.New("EC2 SD configuration filter values cannot be empty")
|
||||
}
|
||||
}
|
||||
return nil
|
||||
return c.HTTPClientConfig.Validate()
|
||||
}
|
||||
|
||||
// EC2Discovery periodically performs EC2-SD requests. It implements
|
||||
|
|
Loading…
Reference in New Issue