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
663f2b0f
Commit
663f2b0f
authored
Sep 07, 2016
by
Matt Butcher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(tiller): add test for failed hooks
parent
53b01949
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
1 deletion
+36
-1
release_server.go
cmd/tiller/release_server.go
+1
-1
release_server_test.go
cmd/tiller/release_server_test.go
+35
-0
No files found.
cmd/tiller/release_server.go
View file @
663f2b0f
...
...
@@ -588,7 +588,7 @@ func (s *releaseServer) execHook(hs []*release.Hook, name, namespace, hook strin
b
:=
bytes
.
NewBufferString
(
h
.
Manifest
)
if
err
:=
kubeCli
.
Create
(
namespace
,
b
);
err
!=
nil
{
log
.
Printf
(
"wrning: Release %q pre-install %s failed: %s"
,
name
,
h
.
Path
,
err
)
log
.
Printf
(
"w
a
rning: Release %q pre-install %s failed: %s"
,
name
,
h
.
Path
,
err
)
return
err
}
// No way to rewind a bytes.Buffer()?
...
...
cmd/tiller/release_server_test.go
View file @
663f2b0f
...
...
@@ -17,7 +17,9 @@ limitations under the License.
package
main
import
(
"errors"
"fmt"
"io"
"os"
"regexp"
"strings"
...
...
@@ -431,6 +433,25 @@ func TestInstallReleaseNoHooks(t *testing.T) {
}
}
func
TestInstallReleaseFailedHooks
(
t
*
testing
.
T
)
{
c
:=
context
.
Background
()
rs
:=
rsFixture
()
rs
.
env
.
Releases
.
Create
(
releaseStub
())
rs
.
env
.
KubeClient
=
newHookFailingKubeClient
()
req
:=
&
services
.
InstallReleaseRequest
{
Chart
:
chartStub
(),
}
res
,
err
:=
rs
.
InstallRelease
(
c
,
req
)
if
err
==
nil
{
t
.
Error
(
"Expected failed install"
)
}
if
hl
:=
res
.
Release
.
Info
.
Status
.
Code
;
hl
!=
release
.
Status_FAILED
{
t
.
Errorf
(
"Expected FAILED release. Got %d"
,
hl
)
}
}
func
TestInstallReleaseReuseName
(
t
*
testing
.
T
)
{
c
:=
context
.
Background
()
rs
:=
rsFixture
()
...
...
@@ -912,6 +933,20 @@ func mockEnvironment() *environment.Environment {
return
e
}
func
newHookFailingKubeClient
()
*
hookFailingKubeClient
{
return
&
hookFailingKubeClient
{
PrintingKubeClient
:
environment
.
PrintingKubeClient
{
Out
:
os
.
Stdout
},
}
}
type
hookFailingKubeClient
struct
{
environment
.
PrintingKubeClient
}
func
(
h
*
hookFailingKubeClient
)
WatchUntilReady
(
ns
string
,
r
io
.
Reader
)
error
{
return
errors
.
New
(
"Failed watch"
)
}
type
mockListServer
struct
{
val
*
services
.
ListReleasesResponse
}
...
...
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