mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-11 17:12:51 +00:00
move test case
This commit is contained in:
@@ -138,6 +138,22 @@ kind: Namespace
|
|||||||
metadata:
|
metadata:
|
||||||
annotations:
|
annotations:
|
||||||
foo: bar
|
foo: bar
|
||||||
|
`),
|
||||||
|
expectedOut: nil,
|
||||||
|
expectedErr: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "nil value in list",
|
||||||
|
input: []byte(`
|
||||||
|
apiVersion: builtin
|
||||||
|
kind: ConfigMapGenerator
|
||||||
|
metadata:
|
||||||
|
name: kube100-site
|
||||||
|
labels:
|
||||||
|
app: web
|
||||||
|
testList:
|
||||||
|
- testA
|
||||||
|
-
|
||||||
`),
|
`),
|
||||||
expectedOut: nil,
|
expectedOut: nil,
|
||||||
expectedErr: true,
|
expectedErr: true,
|
||||||
|
|||||||
@@ -98,21 +98,6 @@ items:
|
|||||||
patch7 := `
|
patch7 := `
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: List
|
kind: List
|
||||||
`
|
|
||||||
patchList5 := types.PatchStrategicMerge("patch8.yaml")
|
|
||||||
patch8 := `
|
|
||||||
apiVersion: builtin
|
|
||||||
kind: ConfigMapGenerator
|
|
||||||
metadata:
|
|
||||||
name: kube100-site
|
|
||||||
labels:
|
|
||||||
app: web
|
|
||||||
testList:
|
|
||||||
- testA
|
|
||||||
-
|
|
||||||
literals:
|
|
||||||
- FRUIT=apple
|
|
||||||
- VEGETABLE=carrot
|
|
||||||
`
|
`
|
||||||
testDeploymentSpec := map[string]interface{}{
|
testDeploymentSpec := map[string]interface{}{
|
||||||
"template": map[string]interface{}{
|
"template": map[string]interface{}{
|
||||||
@@ -154,7 +139,6 @@ literals:
|
|||||||
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))
|
l.AddFile("/"+string(patchList4), []byte(patch7))
|
||||||
l.AddFile("/"+string(patchList5), []byte(patch8))
|
|
||||||
|
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
@@ -204,12 +188,6 @@ literals:
|
|||||||
expectedOut: []*Resource{},
|
expectedOut: []*Resource{},
|
||||||
expectedErr: false,
|
expectedErr: false,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: "listWithEmptyList",
|
|
||||||
input: []types.PatchStrategicMerge{patchList5},
|
|
||||||
expectedOut: []*Resource{},
|
|
||||||
expectedErr: true,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
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