Merge pull request #95 from Liujingfang1/crdsupport

Add skeleton for CRD support
This commit is contained in:
Jeff Regan
2018-06-12 09:21:10 -07:00
committed by GitHub
8 changed files with 114 additions and 1 deletions

View File

@@ -312,3 +312,23 @@ func TestAnnotationsRun(t *testing.T) {
t.Fatalf("actual doesn't match expected: %v", err)
}
}
func TestAddPathConfigs(t *testing.T) {
aexpected := len(defaultAnnotationsPathConfigs) + 1
lexpected := len(defaultLabelsPathConfigs) + 1
pathConfigs := []PathConfig{
{
GroupVersionKind: &schema.GroupVersionKind{Group: "GroupA", Kind: "KindB"},
Path: []string{"path", "to", "a", "field"},
CreateIfNotPresent: true,
},
}
AddLabelsPathConfigs(pathConfigs)
AddAnnotationsPathConfigs(pathConfigs)
if len(defaultAnnotationsPathConfigs) != aexpected {
t.Fatalf("actual %v doesn't match expected: %v", len(defaultAnnotationsPathConfigs), aexpected)
}
if len(defaultLabelsPathConfigs) != lexpected {
t.Fatalf("actual %v doesn't match expected: %v", len(defaultLabelsPathConfigs), lexpected)
}
}