Add test representing 2960

This commit is contained in:
Jeffrey Regan
2020-09-11 15:22:41 -07:00
parent a6e03e4d11
commit 950c1de46d

View File

@@ -4,12 +4,13 @@
package krusty_test
import (
"strings"
"testing"
kusttest_test "sigs.k8s.io/kustomize/api/testutils/kusttest"
)
func TestNullValues(t *testing.T) {
func TestNullValues1(t *testing.T) {
th := kusttest_test.MakeHarness(t)
th.WriteF("/app/deployment.yaml", `
apiVersion: apps/v1
@@ -62,3 +63,31 @@ spec:
name: example
`)
}
func TestNullValues2(t *testing.T) {
th := kusttest_test.MakeHarness(t)
th.WriteF("deploy.yaml", `
apiVersion: apps/v1
kind: Deployment
metadata:
name: test
spec:
template:
spec:
containers:
- name: test
volumes: null
`)
th.WriteK(".", `
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)
}
}