mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-05-17 18:25:26 +00:00
Add test representing 2960
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user