Merge pull request #435 from Liujingfang1/flakytest

fix the flaky test in crd package
This commit is contained in:
Jeff Regan
2018-10-09 09:33:20 -07:00
committed by GitHub

View File

@@ -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)
}