mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-05-18 12:42:19 +00:00
81 lines
1.6 KiB
Go
81 lines
1.6 KiB
Go
/*
|
|
Copyright 2018 The Kubernetes Authors.
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
*/
|
|
|
|
package target_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"sigs.k8s.io/kustomize/api/testutils/kusttest"
|
|
)
|
|
|
|
func TestNullValues(t *testing.T) {
|
|
th := kusttest_test.NewKustTestHarness(t, "/app")
|
|
th.WriteF("/app/deployment.yaml", `
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
labels:
|
|
app: example
|
|
name: example
|
|
spec:
|
|
selector:
|
|
matchLabels:
|
|
app: example
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: example
|
|
spec:
|
|
containers:
|
|
- args: null
|
|
image: image
|
|
name: example
|
|
`)
|
|
th.WriteF("/app/kustomization.yaml", `
|
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
|
kind: Kustomization
|
|
resources:
|
|
- deployment.yaml
|
|
`)
|
|
m, err := th.MakeKustTarget().MakeCustomizedResMap()
|
|
if err != nil {
|
|
t.Fatalf("Err: %v", err)
|
|
}
|
|
|
|
th.AssertActualEqualsExpected(m, `
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
labels:
|
|
app: example
|
|
name: example
|
|
spec:
|
|
selector:
|
|
matchLabels:
|
|
app: example
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: example
|
|
spec:
|
|
containers:
|
|
- args: null
|
|
image: image
|
|
name: example
|
|
`)
|
|
}
|