mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-07-17 17:52:12 +00:00
Merge pull request #435 from Liujingfang1/flakytest
fix the flaky test in crd package
This commit is contained in:
@@ -18,6 +18,7 @@ package crds
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"reflect"
|
"reflect"
|
||||||
|
"sort"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"sigs.k8s.io/kustomize/pkg/gvk"
|
"sigs.k8s.io/kustomize/pkg/gvk"
|
||||||
@@ -181,6 +182,14 @@ func TestRegisterCRD(t *testing.T) {
|
|||||||
|
|
||||||
pathconfig, _ := registerCRD(ldr, "/testpath/crd.json")
|
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) {
|
if !reflect.DeepEqual(pathconfig, expected) {
|
||||||
t.Fatalf("expected\n %v\n but got\n %v\n", expected, pathconfig)
|
t.Fatalf("expected\n %v\n but got\n %v\n", expected, pathconfig)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user