Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
H
helm3
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
helm3
Commits
4b3d3cfa
Commit
4b3d3cfa
authored
Mar 23, 2016
by
Adam Reese
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test(cli): use table test for deployments
parent
b03f2bcc
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
11 deletions
+32
-11
deployment_test.go
cmd/helm/deployment_test.go
+32
-11
No files found.
cmd/helm/deployment_test.go
View file @
4b3d3cfa
...
@@ -25,27 +25,48 @@ import (
...
@@ -25,27 +25,48 @@ import (
)
)
func
TestShowDeployment
(
t
*
testing
.
T
)
{
func
TestShowDeployment
(
t
*
testing
.
T
)
{
th
:=
setup
()
var
deploymentTestCases
=
[]
struct
{
defer
th
.
teardown
()
args
[]
string
resp
*
common
.
Deployment
deployment
:=
common
.
NewDeployment
(
"guestbook.yaml"
)
expected
string
}{
{
[]
string
{
"deployment"
,
"show"
,
"guestbook.yaml"
},
&
common
.
Deployment
{
Name
:
"guestbook.yaml"
,
State
:
&
common
.
DeploymentState
{
Status
:
common
.
CreatedStatus
},
},
"Name: guestbook.yaml
\n
Status: Created
\n
"
,
},
{
[]
string
{
"deployment"
,
"show"
,
"guestbook.yaml"
},
&
common
.
Deployment
{
Name
:
"guestbook.yaml"
,
State
:
&
common
.
DeploymentState
{
common
.
FailedStatus
,
[]
string
{
"error message"
},
},
},
"Name: guestbook.yaml
\n
Status: Failed
\n
Errors:
\n
error message
\n
"
,
},
}
for
_
,
tc
:=
range
deploymentTestCases
{
th
:=
setup
()
th
.
mux
.
HandleFunc
(
"/deployments/"
,
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
th
.
mux
.
HandleFunc
(
"/deployments/"
,
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
data
,
err
:=
json
.
Marshal
(
deployment
)
data
,
err
:=
json
.
Marshal
(
tc
.
resp
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
}
}
w
.
Write
(
data
)
w
.
Write
(
data
)
})
})
expected
:=
"Name: guestbook.yaml
\n
Status: Created
\n
"
actual
:=
CaptureOutput
(
func
()
{
actual
:=
CaptureOutput
(
func
()
{
th
.
Run
(
"deployment"
,
"show"
,
"guestbook.yaml"
)
th
.
Run
(
tc
.
args
...
)
})
})
if
tc
.
expected
!=
actual
{
if
expected
!=
actual
{
t
.
Errorf
(
"Expected %v got %v"
,
tc
.
expected
,
actual
)
t
.
Errorf
(
"Expected %v got %v"
,
expected
,
actual
)
}
th
.
teardown
()
}
}
}
}
...
...
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