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

pull/2720/merge
Julius Volz 8 years ago committed by GitHub
parent e0f046396a
commit 240bb671e2

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

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

@ -0,0 +1,2 @@
global:
nonexistent_field: test
Loading…
Cancel
Save