Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
Ijaz Ahmad
ksonnet
Commits
e79264c9
Unverified
Commit
e79264c9
authored
Apr 06, 2018
by
bryanl
Browse files
Updating e2e tests with env globals
Signed-off-by:
bryanl
<
bryanliles@gmail.com
>
parent
acf99637
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
64 additions
and
2 deletions
+64
-2
cmd/actions.go
cmd/actions.go
+2
-0
cmd/param_delete.go
cmd/param_delete.go
+1
-1
cmd/param_delete_test.go
cmd/param_delete_test.go
+13
-1
e2e/param_test.go
e2e/param_test.go
+29
-0
e2e/testdata/output/param/delete/env-global.txt
e2e/testdata/output/param/delete/env-global.txt
+10
-0
e2e/testdata/output/param/set/env-global.txt
e2e/testdata/output/param/set/env-global.txt
+9
-0
No files found.
cmd/actions.go
View file @
e79264c9
...
...
@@ -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
,
...
...
cmd/param_delete.go
View file @
e79264c9
...
...
@@ -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
...
...
cmd/param_delete_test.go
View file @
e79264c9
...
...
@@ -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
)
...
...
e2e/param_test.go
View file @
e79264c9
...
...
@@ -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
)
})
})
})
})
e2e/testdata/output/param/delete/env-global.txt
0 → 100644
View file @
e79264c9
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"
e2e/testdata/output/param/set/env-global.txt
0 → 100644
View file @
e79264c9
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"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment