mirror of
https://github.com/prometheus/prometheus
synced 2026-05-01 07:30:30 +08:00
config: Fix overflow checking in global config (#2783)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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",
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
2
config/testdata/unknown_global_attr.bad.yml
vendored
Normal file
2
config/testdata/unknown_global_attr.bad.yml
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
global:
|
||||
nonexistent_field: test
|
||||
Reference in New Issue
Block a user