Add support for CRDs

This commit is contained in:
Jingfang Liu
2018-06-11 14:12:48 -07:00
parent 9459665c96
commit 4f05482e00
8 changed files with 114 additions and 1 deletions

View File

@@ -22,6 +22,7 @@ import (
"github.com/kubernetes-sigs/kustomize/pkg/resmap"
"github.com/kubernetes-sigs/kustomize/pkg/resource"
"k8s.io/apimachinery/pkg/runtime/schema"
)
func TestNameReferenceRun(t *testing.T) {
@@ -199,3 +200,29 @@ func TestNameReferenceRun(t *testing.T) {
t.Fatalf("actual doesn't match expected: %v", err)
}
}
func TestAddNameReferencePathConfigs(t *testing.T) {
expected := len(defaultNameReferencePathConfigs) + 1
pathConfigs := []referencePathConfig{
{
referencedGVK: schema.GroupVersionKind{
Kind: "KindA",
},
pathConfigs: []PathConfig{
{
GroupVersionKind: &schema.GroupVersionKind{
Kind: "KindB",
},
Path: []string{"path", "to", "a", "field"},
CreateIfNotPresent: false,
},
},
},
}
AddNameReferencePathConfigs(pathConfigs)
if len(defaultNameReferencePathConfigs) != expected {
t.Fatalf("actual %v doesn't match expected: %v", len(defaultAnnotationsPathConfigs), expected)
}
}