diff --git a/cmd/actions.go b/cmd/actions.go index d97cc1f0..f52d78aa 100644 --- a/cmd/actions.go +++ b/cmd/actions.go @@ -42,6 +42,7 @@ const ( actionParamDiff actionParamList actionParamSet + actionParamUnset actionPkgDescribe actionPkgInstall actionPkgList @@ -79,6 +80,7 @@ var ( actionModuleList: actions.RunModuleList, // actionParamDiff actionParamDelete: actions.RunParamDelete, + actionParamUnset: actions.RunParamDelete, actionParamList: actions.RunParamList, actionParamSet: actions.RunParamSet, actionPkgDescribe: actions.RunPkgDescribe, diff --git a/cmd/param_delete.go b/cmd/param_delete.go index a3364196..9724edf1 100644 --- a/cmd/param_delete.go +++ b/cmd/param_delete.go @@ -28,7 +28,7 @@ var ( ) var paramDeleteCmd = &cobra.Command{ - Use: "delete ", + Use: "delete [component-name] ", Short: paramShortDesc["delete"], RunE: func(cmd *cobra.Command, args []string) error { var name string diff --git a/cmd/param_delete_test.go b/cmd/param_delete_test.go index 0e95765c..5dc47cf1 100644 --- a/cmd/param_delete_test.go +++ b/cmd/param_delete_test.go @@ -24,7 +24,7 @@ import ( func Test_paramDeleteCmd(t *testing.T) { cases := []cmdTestCase{ { - name: "in general", + name: "with a component", args: []string{"param", "delete", "component-name", "param-name"}, action: actionParamDelete, expected: map[string]interface{}{ @@ -35,6 +35,18 @@ func Test_paramDeleteCmd(t *testing.T) { actions.OptionIndex: 0, }, }, + { + name: "without a component", + args: []string{"param", "delete", "param-name", "--env", "default"}, + action: actionParamDelete, + expected: map[string]interface{}{ + actions.OptionApp: ka, + actions.OptionName: "", + actions.OptionPath: "param-name", + actions.OptionEnvName: "default", + actions.OptionIndex: 0, + }, + }, } runTestCmd(t, cases) diff --git a/e2e/param_test.go b/e2e/param_test.go index 592296c3..7012a3ec 100644 --- a/e2e/param_test.go +++ b/e2e/param_test.go @@ -74,6 +74,23 @@ var _ = Describe("ks param", func() { assertOutput("param/delete/env.txt", o.stdout) }) }) + + FContext("removing environment global", func() { + BeforeEach(func() { + o := a.runKs("param", "set", "department", "engineering", "--env", "default") + assertExitStatus(o, 0) + }) + + JustBeforeEach(func() { + o := a.runKs("param", "delete", "department", "--env", "default") + assertExitStatus(o, 0) + }) + + It("removes the value", func() { + o := a.paramList("--env", "default") + assertOutput("param/delete/env-global.txt", o.stdout) + }) + }) }) Describe("list", func() { @@ -124,6 +141,18 @@ var _ = Describe("ks param", func() { }) }) + + FContext("setting environment global", func() { + JustBeforeEach(func() { + o := a.runKs("param", "set", "department", "engineering", "--env", "default") + assertExitStatus(o, 0) + }) + + It("sets the value", func() { + o := a.paramList("--env", "default") + assertOutput("param/set/env-global.txt", o.stdout) + }) + }) }) }) diff --git a/e2e/testdata/output/param/delete/env-global.txt b/e2e/testdata/output/param/delete/env-global.txt new file mode 100644 index 00000000..d69c4bc5 --- /dev/null +++ b/e2e/testdata/output/param/delete/env-global.txt @@ -0,0 +1,10 @@ +COMPONENT INDEX PARAM VALUE +========= ===== ===== ===== +guestbook-ui 0 containerPort 80 +guestbook-ui 0 env-value 2 +guestbook-ui 0 image "gcr.io/heptio-images/ks-guestbook-demo:0.1" +guestbook-ui 0 local-value 1 +guestbook-ui 0 name "guestbook-ui" +guestbook-ui 0 replicas 1 +guestbook-ui 0 servicePort 80 +guestbook-ui 0 type "ClusterIP" diff --git a/e2e/testdata/output/param/set/env-global.txt b/e2e/testdata/output/param/set/env-global.txt new file mode 100644 index 00000000..eeca1080 --- /dev/null +++ b/e2e/testdata/output/param/set/env-global.txt @@ -0,0 +1,9 @@ +COMPONENT INDEX PARAM VALUE +========= ===== ===== ===== +guestbook-ui 0 containerPort 80 +guestbook-ui 0 department "engineering" +guestbook-ui 0 image "gcr.io/heptio-images/ks-guestbook-demo:0.1" +guestbook-ui 0 name "guestbook-ui" +guestbook-ui 0 replicas 1 +guestbook-ui 0 servicePort 80 +guestbook-ui 0 type "ClusterIP"