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
4edccdea
Commit
4edccdea
authored
Apr 03, 2016
by
vaikas-google
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix the tests for the command
parent
7587769d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
26 deletions
+40
-26
deployment_test.go
cmd/helm/deployment_test.go
+40
-26
No files found.
cmd/helm/deployment_test.go
View file @
4edccdea
...
@@ -24,64 +24,78 @@ import (
...
@@ -24,64 +24,78 @@ import (
"github.com/kubernetes/helm/pkg/common"
"github.com/kubernetes/helm/pkg/common"
)
)
type
pathAndResponse
struct
{
path
string
resp
interface
{}
}
func
TestDeployment
(
t
*
testing
.
T
)
{
func
TestDeployment
(
t
*
testing
.
T
)
{
var
deploymentTestCases
=
[]
struct
{
var
deploymentTestCases
=
[]
struct
{
args
[]
string
args
[]
string
resp
interface
{}
resp
[]
pathAndResponse
expected
string
expected
string
}{
}{
{
{
[]
string
{
"deployment"
,
"show"
,
"guestbook.yaml"
},
[]
string
{
"deployment"
,
"show"
,
"guestbook.yaml"
},
&
common
.
Deployment
{
[]
pathAndResponse
{{
"/deployments/"
,
&
common
.
Deployment
{
Name
:
"guestbook.yaml"
,
Name
:
"guestbook.yaml"
,
State
:
&
common
.
DeploymentState
{
Status
:
common
.
CreatedStatus
},
State
:
&
common
.
DeploymentState
{
Status
:
common
.
CreatedStatus
},
},
}
}}
,
"Name: guestbook.yaml
\n
Status: Created
\n
"
,
"Name: guestbook.yaml
\n
Status: Created
\n
"
,
},
},
{
{
[]
string
{
"deployment"
,
"show"
,
"guestbook.yaml"
},
[]
string
{
"deployment"
,
"show"
,
"guestbook.yaml"
},
&
common
.
Deployment
{
[]
pathAndResponse
{{
"/deployments/"
,
&
common
.
Deployment
{
Name
:
"guestbook.yaml"
,
Name
:
"guestbook.yaml"
,
State
:
&
common
.
DeploymentState
{
State
:
&
common
.
DeploymentState
{
Status
:
common
.
FailedStatus
,
Status
:
common
.
FailedStatus
,
Errors
:
[]
string
{
"error message"
},
Errors
:
[]
string
{
"error message"
},
},
},
},
}
}}
,
"Name: guestbook.yaml
\n
Status: Failed
\n
Errors:
\n
error message
\n
"
,
"Name: guestbook.yaml
\n
Status: Failed
\n
Errors:
\n
error message
\n
"
,
},
},
{
{
[]
string
{
"deployment"
,
"list"
},
[]
string
{
"deployment"
,
"list"
},
[]
string
{
"guestbook.yaml"
},
[]
pathAndResponse
{{
"/deployments/"
,
[]
string
{
"guestbook.yaml"
}}
},
"guestbook.yaml
\n
"
,
"guestbook.yaml
\n
"
,
},
},
{
{
[]
string
{
"deployment"
,
"describe"
,
"guestbook.yaml"
},
[]
string
{
"deployment"
,
"describe"
,
"guestbook.yaml"
},
&
common
.
Manifest
{
[]
pathAndResponse
{{
Deployment
:
"guestbook.yaml"
,
"/deployments/guestbook.yaml"
,
Name
:
"manifestxyz"
,
&
common
.
Deployment
{
Name
:
"guestbook.yaml"
,
ExpandedConfig
:
&
common
.
Configuration
{
State
:
&
common
.
DeploymentState
{
Status
:
common
.
CreatedStatus
},
Resources
:
[]
*
common
.
Resource
{
LatestManifest
:
"manifestxyz"
,
{
Name
:
"fe-rc"
,
Type
:
"ReplicationController"
,
State
:
&
common
.
ResourceState
{
Status
:
common
.
Created
}},
}},
{
Name
:
"fe"
,
Type
:
"Service"
,
State
:
&
common
.
ResourceState
{
Status
:
common
.
Created
}},
{
"/deployments/guestbook.yaml/manifests/manifestxyz"
,
&
common
.
Manifest
{
{
Name
:
"be-rc"
,
Type
:
"ReplicationController"
,
State
:
&
common
.
ResourceState
{
Status
:
common
.
Created
}},
Deployment
:
"guestbook.yaml"
,
{
Name
:
"be"
,
Type
:
"Service"
,
State
:
&
common
.
ResourceState
{
Status
:
common
.
Created
}},
Name
:
"manifestxyz"
,
ExpandedConfig
:
&
common
.
Configuration
{
Resources
:
[]
*
common
.
Resource
{
{
Name
:
"fe-rc"
,
Type
:
"ReplicationController"
,
State
:
&
common
.
ResourceState
{
Status
:
common
.
Created
}},
{
Name
:
"fe"
,
Type
:
"Service"
,
State
:
&
common
.
ResourceState
{
Status
:
common
.
Created
}},
{
Name
:
"be-rc"
,
Type
:
"ReplicationController"
,
State
:
&
common
.
ResourceState
{
Status
:
common
.
Created
}},
{
Name
:
"be"
,
Type
:
"Service"
,
State
:
&
common
.
ResourceState
{
Status
:
common
.
Created
}},
},
},
},
},
}}},
},
"Name: fe-rc
\n
Type: ReplicationController
\n
Status: Created
\n
"
+
"Name: fe-rc
\n
Type: ReplicationController
\n
Status: Created
\n
"
+
"Name: fe
\n
Type: Service
\n
Status: Created
\n
"
+
"Name: fe
\n
Type: Service
\n
Status: Created
\n
"
+
"Name: be-rc
\n
Type: ReplicationController
\n
Status: Created
\n
"
+
"Name: be-rc
\n
Type: ReplicationController
\n
Status: Created
\n
"
+
"Name: be
\n
Type: Service
\n
Status: Created
\n
"
,
"Name: be
\n
Type: Service
\n
Status: Created
\n
"
,
},
},
}
}
for
_
,
tc
:=
range
deploymentTestCases
{
for
_
,
tc
:=
range
deploymentTestCases
{
th
:=
testHelm
(
t
)
th
:=
testHelm
(
t
)
th
.
mux
.
HandleFunc
(
"/deployments/"
,
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
for
_
,
pathAndResponse
:=
range
tc
.
resp
{
data
,
err
:=
json
.
Marshal
(
tc
.
resp
)
var
response
=
pathAndResponse
.
resp
th
.
must
(
err
)
th
.
mux
.
HandleFunc
(
pathAndResponse
.
path
,
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
w
.
Write
(
data
)
data
,
err
:=
json
.
Marshal
(
response
)
})
th
.
must
(
err
)
w
.
Write
(
data
)
})
}
th
.
run
(
tc
.
args
...
)
th
.
run
(
tc
.
args
...
)
...
...
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