Unverified Commit e79264c9 authored by bryanl's avatar bryanl
Browse files

Updating e2e tests with env globals


Signed-off-by: default avatarbryanl <bryanliles@gmail.com>
parent acf99637
......@@ -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,
......
......@@ -28,7 +28,7 @@ var (
)
var paramDeleteCmd = &cobra.Command{
Use: "delete <component-name> <param-key>",
Use: "delete [component-name] <param-key>",
Short: paramShortDesc["delete"],
RunE: func(cmd *cobra.Command, args []string) error {
var name string
......
......@@ -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)
......
......@@ -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)
})
})
})
})
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"
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"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment