CloudWatch: fix non-deterministic test (#57831)

This commit is contained in:
Shirley 2022-10-28 16:05:55 +02:00 committed by GitHub
parent 6b483a8dca
commit c2e9e797b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,6 +3,7 @@ package models
import (
"encoding/json"
"fmt"
"sort"
"testing"
"time"
@ -948,9 +949,12 @@ func Test_ParseMetricDataQueries_migrate_alias_to_label(t *testing.T) {
res, err := ParseMetricDataQueries(query, time.Now(), time.Now(), true)
assert.NoError(t, err)
require.Len(t, res, 2)
sort.Slice(res, func(i, j int) bool {
return res[i].RefId < res[j].RefId
})
require.NotNil(t, res[0])
assert.Equal(t, "{{period}} {{any_other_word}}", res[0].Alias)
assert.Equal(t, "${PROP('Period')} ${PROP('Dim.any_other_word')}", res[0].Label)