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,15 +704,15 @@ func resourceDatadogTimeboardExists(d *schema.ResourceData, meta interface{}) (b
|
||||||
func validateAggregatorMethod(v interface{}, k string) (ws []string, errors []error) {
|
func validateAggregatorMethod(v interface{}, k string) (ws []string, errors []error) {
|
||||||
value := v.(string)
|
value := v.(string)
|
||||||
validMethods := map[string]struct{}{
|
validMethods := map[string]struct{}{
|
||||||
"average": {},
|
"avg": {},
|
||||||
"max": {},
|
"max": {},
|
||||||
"min": {},
|
"min": {},
|
||||||
"sum": {},
|
"sum": {},
|
||||||
"last": {},
|
"last": {},
|
||||||
}
|
}
|
||||||
if _, ok := validMethods[value]; !ok {
|
if _, ok := validMethods[value]; !ok {
|
||||||
errors = append(errors, fmt.Errorf(
|
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
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -224,7 +224,7 @@ func checkDestroy(s *terraform.State) error {
|
||||||
|
|
||||||
func TestValidateAggregatorMethod(t *testing.T) {
|
func TestValidateAggregatorMethod(t *testing.T) {
|
||||||
validMethods := []string{
|
validMethods := []string{
|
||||||
"average",
|
"avg",
|
||||||
"max",
|
"max",
|
||||||
"min",
|
"min",
|
||||||
"sum",
|
"sum",
|
||||||
|
@ -237,7 +237,7 @@ func TestValidateAggregatorMethod(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
invalidMethods := []string{
|
invalidMethods := []string{
|
||||||
"avg",
|
"average",
|
||||||
"suM",
|
"suM",
|
||||||
"m",
|
"m",
|
||||||
"foo",
|
"foo",
|
||||||
|
|
Loading…
Reference in New Issue