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
69b03a33
Commit
69b03a33
authored
Oct 13, 2016
by
Michelle Noorali
Committed by
GitHub
Oct 13, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1335 from michelleN/ref-perform-update
bug(tiller): set status correctly in performUpdate
parents
e78cce27
57b2e642
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
6 deletions
+60
-6
release_server.go
cmd/tiller/release_server.go
+9
-6
release_server_test.go
cmd/tiller/release_server_test.go
+51
-0
No files found.
cmd/tiller/release_server.go
View file @
69b03a33
...
...
@@ -278,12 +278,12 @@ func (s *releaseServer) UpdateRelease(c ctx.Context, req *services.UpdateRelease
res
,
err
:=
s
.
performUpdate
(
currentRelease
,
updatedRelease
,
req
)
if
err
!=
nil
{
return
nil
,
err
return
res
,
err
}
if
!
req
.
DryRun
{
if
err
:=
s
.
env
.
Releases
.
Create
(
updatedRelease
);
err
!=
nil
{
return
nil
,
err
return
res
,
err
}
}
...
...
@@ -306,7 +306,12 @@ func (s *releaseServer) performUpdate(originalRelease, updatedRelease *release.R
}
if
err
:=
s
.
performKubeUpdate
(
originalRelease
,
updatedRelease
);
err
!=
nil
{
return
nil
,
err
log
.
Printf
(
"warning: Release Upgrade %q failed: %s"
,
updatedRelease
.
Name
,
err
)
originalRelease
.
Info
.
Status
.
Code
=
release
.
Status_SUPERSEDED
updatedRelease
.
Info
.
Status
.
Code
=
release
.
Status_FAILED
s
.
recordRelease
(
originalRelease
,
true
)
s
.
recordRelease
(
updatedRelease
,
false
)
return
res
,
err
}
// post-upgrade hooks
...
...
@@ -317,9 +322,7 @@ func (s *releaseServer) performUpdate(originalRelease, updatedRelease *release.R
}
originalRelease
.
Info
.
Status
.
Code
=
release
.
Status_SUPERSEDED
if
err
:=
s
.
env
.
Releases
.
Update
(
originalRelease
);
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"Update of %s failed: %s"
,
originalRelease
.
Name
,
err
)
}
s
.
recordRelease
(
originalRelease
,
true
)
updatedRelease
.
Info
.
Status
.
Code
=
release
.
Status_DEPLOYED
...
...
cmd/tiller/release_server_test.go
View file @
69b03a33
...
...
@@ -587,6 +587,42 @@ func TestUpdateRelease(t *testing.T) {
}
}
func
TestUpdateReleaseFailure
(
t
*
testing
.
T
)
{
c
:=
helm
.
NewContext
()
rs
:=
rsFixture
()
rel
:=
releaseStub
()
rs
.
env
.
Releases
.
Create
(
rel
)
rs
.
env
.
KubeClient
=
newUpdateFailingKubeClient
()
req
:=
&
services
.
UpdateReleaseRequest
{
Name
:
rel
.
Name
,
DisableHooks
:
true
,
Chart
:
&
chart
.
Chart
{
Metadata
:
&
chart
.
Metadata
{
Name
:
"hello"
},
Templates
:
[]
*
chart
.
Template
{
{
Name
:
"something"
,
Data
:
[]
byte
(
"hello: world"
)},
},
},
}
res
,
err
:=
rs
.
UpdateRelease
(
c
,
req
)
if
err
==
nil
{
t
.
Error
(
"Expected failed update"
)
}
if
updatedStatus
:=
res
.
Release
.
Info
.
Status
.
Code
;
updatedStatus
!=
release
.
Status_FAILED
{
t
.
Errorf
(
"Expected FAILED release. Got %d"
,
updatedStatus
)
}
oldRelease
,
err
:=
rs
.
env
.
Releases
.
Get
(
rel
.
Name
,
rel
.
Version
)
if
err
!=
nil
{
t
.
Errorf
(
"Expected to be able to get previous release"
)
}
if
oldStatus
:=
oldRelease
.
Info
.
Status
.
Code
;
oldStatus
!=
release
.
Status_SUPERSEDED
{
t
.
Errorf
(
"Expected SUPERSEDED status on previous Release version. Got %v"
,
oldStatus
)
}
}
func
TestUpdateReleaseNoHooks
(
t
*
testing
.
T
)
{
c
:=
helm
.
NewContext
()
rs
:=
rsFixture
()
...
...
@@ -1136,6 +1172,21 @@ func mockEnvironment() *environment.Environment {
return
e
}
func
newUpdateFailingKubeClient
()
*
updateFailingKubeClient
{
return
&
updateFailingKubeClient
{
PrintingKubeClient
:
environment
.
PrintingKubeClient
{
Out
:
os
.
Stdout
},
}
}
type
updateFailingKubeClient
struct
{
environment
.
PrintingKubeClient
}
func
(
u
*
updateFailingKubeClient
)
Update
(
namespace
string
,
originalReader
,
modifiedReader
io
.
Reader
)
error
{
return
errors
.
New
(
"Failed update in kube client"
)
}
func
newHookFailingKubeClient
()
*
hookFailingKubeClient
{
return
&
hookFailingKubeClient
{
PrintingKubeClient
:
environment
.
PrintingKubeClient
{
Out
:
os
.
Stdout
},
...
...
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