mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
CloudWatch: fix non-deterministic test (#57831)
This commit is contained in:
parent
6b483a8dca
commit
c2e9e797b3
@ -3,6 +3,7 @@ package models
|
|||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"sort"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -948,9 +949,12 @@ func Test_ParseMetricDataQueries_migrate_alias_to_label(t *testing.T) {
|
|||||||
|
|
||||||
res, err := ParseMetricDataQueries(query, time.Now(), time.Now(), true)
|
res, err := ParseMetricDataQueries(query, time.Now(), time.Now(), true)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
require.Len(t, res, 2)
|
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])
|
require.NotNil(t, res[0])
|
||||||
assert.Equal(t, "{{period}} {{any_other_word}}", res[0].Alias)
|
assert.Equal(t, "{{period}} {{any_other_word}}", res[0].Alias)
|
||||||
assert.Equal(t, "${PROP('Period')} ${PROP('Dim.any_other_word')}", res[0].Label)
|
assert.Equal(t, "${PROP('Period')} ${PROP('Dim.any_other_word')}", res[0].Label)
|
||||||
|
Loading…
Reference in New Issue
Block a user