Skip to content

Commit

Permalink
modify edit test for null replacements fields
Browse files Browse the repository at this point in the history
  • Loading branch information
natasha41575 committed Nov 8, 2021
1 parent 37ab557 commit 46b3cd2
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
25 changes: 23 additions & 2 deletions kustomize/commands/edit/add/addresource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,29 @@ func TestAddResourceHappyPath(t *testing.T) {
assert.NoError(t, cmd.RunE(cmd, args))
content, err := testutils_test.ReadTestKustomization(fSys)
assert.NoError(t, err)
assert.Contains(t, string(content), resourceFileName)
assert.Contains(t, string(content), resourceFileName+"another")
assert.Equal(t, string(content), `apiVersion: kustomize.config.k8s.io/v1beta1
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) {
Expand Down
2 changes: 2 additions & 0 deletions kustomize/commands/internal/testutils/testutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ resources: []
configMapGenerator: []
# There could be secrets in Base, if just using a fork/rebase workflow
secretGenerator: []
replacements:
- path: replacement.yaml
`
)

Expand Down

0 comments on commit 46b3cd2

Please sign in to comment.