Skip to content

Commit

Permalink
Drop the init command
Browse files Browse the repository at this point in the history
  • Loading branch information
monopole committed Apr 13, 2018
1 parent 0f7bbcd commit 96f4633
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 162 deletions.
21 changes: 19 additions & 2 deletions commands/addresource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,31 @@ const (
resourceFileContent = `
Lorem ipsum dolor sit amet, consectetur adipiscing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
`
kustomizationContent = `kustomizationName: helloworld
namePrefix: some-prefix
# 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
objectLabels:
app: helloworld
objectAnnotations:
note: This is an example annotation
resources: []
#- service.yaml
#- ../some-dir/
# There could also be configmaps in Base, which would make these overlays
configMapGenerator: []
# There could be secrets in Base, if just using a fork/rebase workflow
secretGenerator: []
`
)

func TestAddResourceHappyPath(t *testing.T) {
buf := bytes.NewBuffer([]byte{})
fakeFS := fs.MakeFakeFS()
fakeFS.WriteFile(resourceFileName, []byte(resourceFileContent))
fakeFS.WriteFile(constants.KustomizationFileName, []byte(kustomizationTemplate))
fakeFS.WriteFile(constants.KustomizationFileName, []byte(kustomizationContent))

cmd := newCmdAddResource(buf, os.Stderr, fakeFS)
args := []string{resourceFileName}
Expand All @@ -60,7 +77,7 @@ func TestAddResourceAlreadyThere(t *testing.T) {
buf := bytes.NewBuffer([]byte{})
fakeFS := fs.MakeFakeFS()
fakeFS.WriteFile(resourceFileName, []byte(resourceFileContent))
fakeFS.WriteFile(constants.KustomizationFileName, []byte(kustomizationTemplate))
fakeFS.WriteFile(constants.KustomizationFileName, []byte(kustomizationContent))

cmd := newCmdAddResource(buf, os.Stderr, fakeFS)
args := []string{resourceFileName}
Expand Down
1 change: 0 additions & 1 deletion commands/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ More info at https://github.com/kubernetes/kubectl/tree/master/cmd/kustomize
c.AddCommand(
newCmdBuild(stdOut, stdErr, fsys),
newCmdDiff(stdOut, stdErr, fsys),
newCmdInit(stdOut, stdErr, fsys),
newCmdEdit(stdOut, stdErr, fsys),
version.NewCmdVersion(stdOut),
)
Expand Down
96 changes: 0 additions & 96 deletions commands/init.go

This file was deleted.

62 changes: 0 additions & 62 deletions commands/init_test.go

This file was deleted.

2 changes: 1 addition & 1 deletion commands/set_name_prefix_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const (
func TestSetNamePrefixHappyPath(t *testing.T) {
buf := bytes.NewBuffer([]byte{})
fakeFS := fs.MakeFakeFS()
fakeFS.WriteFile(constants.KustomizationFileName, []byte(kustomizationTemplate))
fakeFS.WriteFile(constants.KustomizationFileName, []byte(kustomizationContent))

cmd := newCmdSetNamePrefix(buf, os.Stderr, fakeFS)
args := []string{goodPrefixValue}
Expand Down

0 comments on commit 96f4633

Please sign in to comment.