diff --git a/pkg/crds/crds_test.go b/pkg/crds/crds_test.go index 13ba9cb73..9d9cc9a73 100644 --- a/pkg/crds/crds_test.go +++ b/pkg/crds/crds_test.go @@ -18,6 +18,7 @@ package crds import ( "reflect" + "sort" "testing" "sigs.k8s.io/kustomize/pkg/gvk" @@ -181,6 +182,14 @@ func TestRegisterCRD(t *testing.T) { pathconfig, _ := registerCRD(ldr, "/testpath/crd.json") + sort.Slice(expected.NameReference[:], func(i, j int) bool { + return expected.NameReference[i].Gvk.String() < expected.NameReference[j].Gvk.String() + }) + + sort.Slice(pathconfig.NameReference[:], func(i, j int) bool { + return pathconfig.NameReference[i].Gvk.String() < pathconfig.NameReference[j].Gvk.String() + }) + if !reflect.DeepEqual(pathconfig, expected) { t.Fatalf("expected\n %v\n but got\n %v\n", expected, pathconfig) }