Allowed method on aggregator is `avg` ! `average` (#14414)
* Allowed method on aggregator is `avg` ! `average` While Datadog will accept the value of `average` when creating the query graph, the resultant graph will be empty. Passing the value of `avg` instead correctly renders the graph. * Fixed gofmt * Updated test to match new aggregator method
This commit is contained in:
parent
a27e142625
commit
0a37f35865
|
@ -704,7 +704,7 @@ func resourceDatadogTimeboardExists(d *schema.ResourceData, meta interface{}) (b
|
|||
func validateAggregatorMethod(v interface{}, k string) (ws []string, errors []error) {
|
||||
value := v.(string)
|
||||
validMethods := map[string]struct{}{
|
||||
"average": {},
|
||||
"avg": {},
|
||||
"max": {},
|
||||
"min": {},
|
||||
"sum": {},
|
||||
|
@ -712,7 +712,7 @@ func validateAggregatorMethod(v interface{}, k string) (ws []string, errors []er
|
|||
}
|
||||
if _, ok := validMethods[value]; !ok {
|
||||
errors = append(errors, fmt.Errorf(
|
||||
`%q contains an invalid method %q. Valid methods are either "average", "max", "min", "sum", or "last"`, k, value))
|
||||
`%q contains an invalid method %q. Valid methods are either "avg", "max", "min", "sum", or "last"`, k, value))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
|
|
@ -224,7 +224,7 @@ func checkDestroy(s *terraform.State) error {
|
|||
|
||||
func TestValidateAggregatorMethod(t *testing.T) {
|
||||
validMethods := []string{
|
||||
"average",
|
||||
"avg",
|
||||
"max",
|
||||
"min",
|
||||
"sum",
|
||||
|
@ -237,7 +237,7 @@ func TestValidateAggregatorMethod(t *testing.T) {
|
|||
}
|
||||
|
||||
invalidMethods := []string{
|
||||
"avg",
|
||||
"average",
|
||||
"suM",
|
||||
"m",
|
||||
"foo",
|
||||
|
|
Loading…
Reference in New Issue