mirror of
https://github.com/grafana/grafana.git
synced 2024-11-26 10:50:37 -06:00
Alerting: Use require.ElementsMatch in TestEvaluateExecutionResultsNoData
This commit is contained in:
parent
11ec1ddd7e
commit
5f5298ad25
@ -2,7 +2,6 @@ package eval
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"sort"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@ -321,11 +320,14 @@ func TestEvaluateExecutionResultsNoData(t *testing.T) {
|
||||
require.Len(t, v, 2)
|
||||
require.Equal(t, NoData, v[0].State)
|
||||
require.Equal(t, NoData, v[1].State)
|
||||
datasourceUIDs := []string{
|
||||
v[0].Instance["datasource_uid"],
|
||||
v[1].Instance["datasource_uid"],
|
||||
|
||||
datasourceUIDs := make([]string, 0, len(v))
|
||||
for _, next := range v {
|
||||
datasourceUID, ok := next.Instance["datasource_uid"]
|
||||
require.True(t, ok)
|
||||
require.NotEqual(t, "", datasourceUID)
|
||||
datasourceUIDs = append(datasourceUIDs, datasourceUID)
|
||||
}
|
||||
sort.Strings(datasourceUIDs)
|
||||
require.Equal(t, []string{"1", "2"}, datasourceUIDs)
|
||||
require.ElementsMatch(t, []string{"1", "2"}, datasourceUIDs)
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user