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
76b3d1e1
Commit
76b3d1e1
authored
Jan 06, 2017
by
Adam Reese
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(tests): fix testclient reactions that were not triggering
parent
a2543f87
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
13 deletions
+27
-13
init_test.go
cmd/helm/init_test.go
+1
-1
install_test.go
cmd/helm/installer/install_test.go
+26
-12
No files found.
cmd/helm/init_test.go
View file @
76b3d1e1
...
@@ -77,7 +77,7 @@ func TestInitCmd_exsits(t *testing.T) {
...
@@ -77,7 +77,7 @@ func TestInitCmd_exsits(t *testing.T) {
Name
:
"tiller-deploy"
,
Name
:
"tiller-deploy"
,
},
},
})
})
fc
.
Ad
dReactor
(
"*"
,
"*"
,
func
(
action
testcore
.
Action
)
(
bool
,
runtime
.
Object
,
error
)
{
fc
.
Prepen
dReactor
(
"*"
,
"*"
,
func
(
action
testcore
.
Action
)
(
bool
,
runtime
.
Object
,
error
)
{
return
true
,
nil
,
errors
.
NewAlreadyExists
(
api
.
Resource
(
"deployments"
),
"1"
)
return
true
,
nil
,
errors
.
NewAlreadyExists
(
api
.
Resource
(
"deployments"
),
"1"
)
})
})
cmd
:=
&
initCmd
{
cmd
:=
&
initCmd
{
...
...
cmd/helm/installer/install_test.go
View file @
76b3d1e1
...
@@ -67,8 +67,8 @@ func TestDeploymentManifest(t *testing.T) {
...
@@ -67,8 +67,8 @@ func TestDeploymentManifest(t *testing.T) {
func
TestInstall
(
t
*
testing
.
T
)
{
func
TestInstall
(
t
*
testing
.
T
)
{
image
:=
"gcr.io/kubernetes-helm/tiller:v2.0.0"
image
:=
"gcr.io/kubernetes-helm/tiller:v2.0.0"
f
ake
:=
fake
.
NewSimpleClientset
()
f
c
:=
&
fake
.
Clientset
{}
f
ake
.
AddReactor
(
"create"
,
"deployments"
,
func
(
action
testcore
.
Action
)
(
bool
,
runtime
.
Object
,
error
)
{
f
c
.
AddReactor
(
"create"
,
"deployments"
,
func
(
action
testcore
.
Action
)
(
bool
,
runtime
.
Object
,
error
)
{
obj
:=
action
.
(
testcore
.
CreateAction
)
.
GetObject
()
.
(
*
extensions
.
Deployment
)
obj
:=
action
.
(
testcore
.
CreateAction
)
.
GetObject
()
.
(
*
extensions
.
Deployment
)
l
:=
obj
.
GetLabels
()
l
:=
obj
.
GetLabels
()
if
reflect
.
DeepEqual
(
l
,
map
[
string
]
string
{
"app"
:
"helm"
})
{
if
reflect
.
DeepEqual
(
l
,
map
[
string
]
string
{
"app"
:
"helm"
})
{
...
@@ -81,15 +81,18 @@ func TestInstall(t *testing.T) {
...
@@ -81,15 +81,18 @@ func TestInstall(t *testing.T) {
return
true
,
obj
,
nil
return
true
,
obj
,
nil
})
})
err
:=
Install
(
fake
.
Extensions
(),
api
.
NamespaceDefault
,
image
,
false
,
false
)
if
err
:=
Install
(
fc
.
Extensions
(),
api
.
NamespaceDefault
,
image
,
false
,
false
);
err
!=
nil
{
if
err
!=
nil
{
t
.
Errorf
(
"unexpected error: %#+v"
,
err
)
t
.
Errorf
(
"unexpected error: %#+v"
,
err
)
}
}
if
actions
:=
fc
.
Actions
();
len
(
actions
)
!=
1
{
t
.
Errorf
(
"unexpected actions: %v, expected 1 actions got %d"
,
actions
,
len
(
actions
))
}
}
}
func
TestInstall_canary
(
t
*
testing
.
T
)
{
func
TestInstall_canary
(
t
*
testing
.
T
)
{
f
ake
:=
fake
.
NewSimpleClientset
()
f
c
:=
&
fake
.
Clientset
{}
f
ake
.
AddReactor
(
"create"
,
"deployments"
,
func
(
action
testcore
.
Action
)
(
bool
,
runtime
.
Object
,
error
)
{
f
c
.
AddReactor
(
"create"
,
"deployments"
,
func
(
action
testcore
.
Action
)
(
bool
,
runtime
.
Object
,
error
)
{
obj
:=
action
.
(
testcore
.
CreateAction
)
.
GetObject
()
.
(
*
extensions
.
Deployment
)
obj
:=
action
.
(
testcore
.
CreateAction
)
.
GetObject
()
.
(
*
extensions
.
Deployment
)
i
:=
obj
.
Spec
.
Template
.
Spec
.
Containers
[
0
]
.
Image
i
:=
obj
.
Spec
.
Template
.
Spec
.
Containers
[
0
]
.
Image
if
i
!=
"gcr.io/kubernetes-helm/tiller:canary"
{
if
i
!=
"gcr.io/kubernetes-helm/tiller:canary"
{
...
@@ -98,18 +101,26 @@ func TestInstall_canary(t *testing.T) {
...
@@ -98,18 +101,26 @@ func TestInstall_canary(t *testing.T) {
return
true
,
obj
,
nil
return
true
,
obj
,
nil
})
})
err
:=
Install
(
fake
.
Extensions
(),
api
.
NamespaceDefault
,
""
,
true
,
false
)
if
err
:=
Install
(
fc
.
Extensions
(),
api
.
NamespaceDefault
,
""
,
true
,
false
);
err
!=
nil
{
if
err
!=
nil
{
t
.
Errorf
(
"unexpected error: %#+v"
,
err
)
t
.
Errorf
(
"unexpected error: %#+v"
,
err
)
}
}
if
actions
:=
fc
.
Actions
();
len
(
actions
)
!=
1
{
t
.
Errorf
(
"unexpected actions: %v, expected 1 actions got %d"
,
actions
,
len
(
actions
))
}
}
}
func
TestUpgrade
(
t
*
testing
.
T
)
{
func
TestUpgrade
(
t
*
testing
.
T
)
{
image
:=
"gcr.io/kubernetes-helm/tiller:v2.0.0"
image
:=
"gcr.io/kubernetes-helm/tiller:v2.0.0"
fc
:=
fake
.
NewSimpleClientset
(
deployment
(
api
.
NamespaceDefault
,
"imageToReplace"
,
false
))
existingDeployment
:=
deployment
(
api
.
NamespaceDefault
,
"imageToReplace"
,
false
)
fc
:=
&
fake
.
Clientset
{}
fc
.
AddReactor
(
"get"
,
"deployments"
,
func
(
action
testcore
.
Action
)
(
bool
,
runtime
.
Object
,
error
)
{
return
true
,
existingDeployment
,
nil
})
fc
.
AddReactor
(
"update"
,
"deployments"
,
func
(
action
testcore
.
Action
)
(
bool
,
runtime
.
Object
,
error
)
{
fc
.
AddReactor
(
"update"
,
"deployments"
,
func
(
action
testcore
.
Action
)
(
bool
,
runtime
.
Object
,
error
)
{
obj
:=
action
.
(
testcore
.
Cre
ateAction
)
.
GetObject
()
.
(
*
extensions
.
Deployment
)
obj
:=
action
.
(
testcore
.
Upd
ateAction
)
.
GetObject
()
.
(
*
extensions
.
Deployment
)
i
:=
obj
.
Spec
.
Template
.
Spec
.
Containers
[
0
]
.
Image
i
:=
obj
.
Spec
.
Template
.
Spec
.
Containers
[
0
]
.
Image
if
i
!=
image
{
if
i
!=
image
{
t
.
Errorf
(
"expected image = '%s', got '%s'"
,
image
,
i
)
t
.
Errorf
(
"expected image = '%s', got '%s'"
,
image
,
i
)
...
@@ -117,8 +128,11 @@ func TestUpgrade(t *testing.T) {
...
@@ -117,8 +128,11 @@ func TestUpgrade(t *testing.T) {
return
true
,
obj
,
nil
return
true
,
obj
,
nil
})
})
err
:=
Upgrade
(
fc
.
Extensions
(),
api
.
NamespaceDefault
,
image
,
false
)
if
err
:=
Upgrade
(
fc
.
Extensions
(),
api
.
NamespaceDefault
,
image
,
false
);
err
!=
nil
{
if
err
!=
nil
{
t
.
Errorf
(
"unexpected error: %#+v"
,
err
)
t
.
Errorf
(
"unexpected error: %#+v"
,
err
)
}
}
if
actions
:=
fc
.
Actions
();
len
(
actions
)
!=
2
{
t
.
Errorf
(
"unexpected actions: %v, expected 2 actions got %d"
,
actions
,
len
(
actions
))
}
}
}
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