ignore null value in fieldspec

This commit is contained in:
Donny Xia
2020-09-14 13:20:20 -07:00
parent 6a0a909e73
commit f0bc926640
7 changed files with 96 additions and 51 deletions

View File

@@ -4,7 +4,6 @@
package krusty_test
import (
"strings"
"testing"
kusttest_test "sigs.k8s.io/kustomize/api/testutils/kusttest"
@@ -73,7 +72,7 @@ metadata:
name: test
spec:
template:
spec:
spec:
containers:
- name: test
volumes: null
@@ -82,12 +81,17 @@ spec:
resources:
- deploy.yaml
`)
err := th.RunWithErr(".", th.MakeDefaultOptions())
if err == nil {
t.Fatalf("expected trouble")
}
if !strings.Contains(
err.Error(), "expected sequence or mapping node") {
t.Fatalf("Unexpected err: %v", err)
}
m := th.Run(".", th.MakeDefaultOptions())
th.AssertActualEqualsExpected(m, `
apiVersion: apps/v1
kind: Deployment
metadata:
name: test
spec:
template:
spec:
containers:
- name: test
volumes: null
`)
}