mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-11 17:12:51 +00:00
add a test for a list with no 'items:' provided
This commit is contained in:
@@ -93,6 +93,11 @@ items:
|
|||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: List
|
kind: List
|
||||||
items:
|
items:
|
||||||
|
`
|
||||||
|
patchList4 := patch.StrategicMerge("patch7.yaml")
|
||||||
|
patch7 := `
|
||||||
|
apiVersion: v1
|
||||||
|
kind: List
|
||||||
`
|
`
|
||||||
testDeploymentSpec := map[string]interface{}{
|
testDeploymentSpec := map[string]interface{}{
|
||||||
"template": map[string]interface{}{
|
"template": map[string]interface{}{
|
||||||
@@ -133,6 +138,7 @@ items:
|
|||||||
l.AddFile("/"+string(patchList), []byte(patch4))
|
l.AddFile("/"+string(patchList), []byte(patch4))
|
||||||
l.AddFile("/"+string(patchList2), []byte(patch5))
|
l.AddFile("/"+string(patchList2), []byte(patch5))
|
||||||
l.AddFile("/"+string(patchList3), []byte(patch6))
|
l.AddFile("/"+string(patchList3), []byte(patch6))
|
||||||
|
l.AddFile("/"+string(patchList4), []byte(patch7))
|
||||||
|
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
@@ -176,6 +182,12 @@ items:
|
|||||||
expectedOut: []*Resource{},
|
expectedOut: []*Resource{},
|
||||||
expectedErr: false,
|
expectedErr: false,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "listWithNo'items:'",
|
||||||
|
input: []patch.StrategicMerge{patchList4},
|
||||||
|
expectedOut: []*Resource{},
|
||||||
|
expectedErr: false,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
rs, err := factory.SliceFromPatches(l, test.input)
|
rs, err := factory.SliceFromPatches(l, test.input)
|
||||||
|
|||||||
Reference in New Issue
Block a user