add tests for *List kinds and empty lists

This commit is contained in:
Andrew Lavery
2019-02-12 12:37:36 -08:00
parent fdba7df3c1
commit 3118ccfd05
2 changed files with 41 additions and 1 deletions

View File

@@ -42,6 +42,15 @@ func TestSliceFromBytes(t *testing.T) {
testConfigMap.Map(),
},
})
testConfigMapList := factory.FromMap(
map[string]interface{}{
"apiVersion": "v1",
"kind": "ConfigMapList",
"items": []interface{}{
testConfigMap.Map(),
testConfigMap.Map(),
},
})
tests := []struct {
name string
@@ -151,6 +160,24 @@ items:
expectedOut: []ifc.Kunstructured{testList},
expectedErr: false,
},
{
name: "ConfigMapList",
input: []byte(`
apiVersion: v1
kind: ConfigMapList
items:
- apiVersion: v1
kind: ConfigMap
metadata:
name: winnie
- apiVersion: v1
kind: ConfigMap
metadata:
name: winnie
`),
expectedOut: []ifc.Kunstructured{testConfigMapList},
expectedErr: false,
},
}
for _, test := range tests {