CloudWatch: Fix ordering of map to resolve flaky test (#21572)

This commit is contained in:
Marcus Efraimsson 2020-01-17 15:27:03 +01:00 committed by GitHub
parent e18d35add4
commit 303bbb9900
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,6 +2,7 @@ package cloudwatch
import (
"fmt"
"sort"
"strconv"
"strings"
"time"
@ -80,7 +81,14 @@ func parseGetMetricDataTimeSeries(metricDataResults map[string]*cloudwatch.Metri
Points: make([]tsdb.TimePoint, 0),
}
for key, values := range query.Dimensions {
keys := make([]string, 0)
for k := range query.Dimensions {
keys = append(keys, k)
}
sort.Strings(keys)
for _, key := range keys {
values := query.Dimensions[key]
if len(values) == 1 && values[0] != "*" {
series.Tags[key] = values[0]
} else {