modify edit test for null replacements fields

This commit is contained in:
natasha41575
2021-11-08 12:21:45 -08:00
parent 37ab5579f0
commit 46b3cd2109
2 changed files with 25 additions and 2 deletions

View File

@@ -33,8 +33,29 @@ func TestAddResourceHappyPath(t *testing.T) {
assert.NoError(t, cmd.RunE(cmd, args)) assert.NoError(t, cmd.RunE(cmd, args))
content, err := testutils_test.ReadTestKustomization(fSys) content, err := testutils_test.ReadTestKustomization(fSys)
assert.NoError(t, err) assert.NoError(t, err)
assert.Contains(t, string(content), resourceFileName) assert.Equal(t, string(content), `apiVersion: kustomize.config.k8s.io/v1beta1
assert.Contains(t, string(content), resourceFileName+"another") kind: Kustomization
namePrefix: some-prefix
nameSuffix: some-suffix
# Labels to add to all objects and selectors.
# These labels would also be used to form the selector for apply --prune
# Named differently than “labels” to avoid confusion with metadata for this object
commonLabels:
app: helloworld
commonAnnotations:
note: This is an example annotation
resources:
- myWonderfulResource.yaml
- myWonderfulResource.yamlanother
#- service.yaml
#- ../some-dir/
# There could also be configmaps in Base, which would make these overlays
# There could be secrets in Base, if just using a fork/rebase workflow
replacements:
- path: replacement.yaml
source: null
targets: null
`)
} }
func TestAddResourceAlreadyThere(t *testing.T) { func TestAddResourceAlreadyThere(t *testing.T) {

View File

@@ -28,6 +28,8 @@ resources: []
configMapGenerator: [] configMapGenerator: []
# There could be secrets in Base, if just using a fork/rebase workflow # There could be secrets in Base, if just using a fork/rebase workflow
secretGenerator: [] secretGenerator: []
replacements:
- path: replacement.yaml
` `
) )