config: Fix overflow checking in global config (#2783)

This commit is contained in:
Julius Volz 2017-05-30 20:58:06 +02:00 committed by GitHub
parent e0f046396a
commit 240bb671e2
3 changed files with 6 additions and 1 deletions

View file

@ -380,7 +380,7 @@ func (c *GlobalConfig) UnmarshalYAML(unmarshal func(interface{}) error) error {
if err := unmarshal((*plain)(gc)); err != nil {
return err
}
if err := checkOverflow(c.XXX, "global config"); err != nil {
if err := checkOverflow(gc.XXX, "global config"); err != nil {
return err
}
// First set the correct scrape interval, then check that the timeout

View file

@ -639,6 +639,9 @@ var expectedErrors = []struct {
}, {
filename: "target_label_hashmod_missing.bad.yml",
errMsg: "relabel configuration for hashmod action requires 'target_label' value",
}, {
filename: "unknown_global_attr.bad.yml",
errMsg: "unknown fields in global config: nonexistent_field",
},
}

View file

@ -0,0 +1,2 @@
global:
nonexistent_field: test