...
1 package status
2
3 import (
4 "github.com/google/go-cmp/cmp"
5 "github.com/google/go-cmp/cmp/cmpopts"
6
7 "edge-infra.dev/pkg/edge/api/graph/model"
8 )
9
10
11
12 func StatusesEqual(statuses1, statuses2 []*model.VirtualMachineStatus) bool {
13 return cmp.Equal(
14 statuses1,
15 statuses2,
16 cmpopts.SortSlices(func(s1, s2 *model.VirtualMachineStatus) bool {
17 if s1.Name != s2.Name {
18 return s1.Name < s2.Name
19 }
20 if s1.Namespace != s2.Namespace {
21 return s1.Namespace < s2.Namespace
22 }
23 return s1.ClusterEdgeID < s2.ClusterEdgeID
24 }),
25 cmpopts.SortSlices(func(c1, c2 *model.ObjStatusCondition) bool {
26 return c1.Type < c2.Type
27 }),
28 cmpopts.EquateEmpty(),
29 )
30 }
31
View as plain text