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
0f18f35d
Commit
0f18f35d
authored
Sep 26, 2017
by
Maxim Ivanov
Committed by
Matthew Fisher
Oct 03, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make Memory driver to store copy of releases to stop hiding storage errors during tests
(cherry picked from commit
ff5acc9b
)
parent
9b900ad8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
12 deletions
+27
-12
records.go
pkg/storage/driver/records.go
+3
-1
release_update_test.go
pkg/tiller/release_update_test.go
+24
-11
No files found.
pkg/storage/driver/records.go
View file @
0f18f35d
...
...
@@ -20,6 +20,8 @@ import (
"sort"
"strconv"
"github.com/golang/protobuf/proto"
rspb
"k8s.io/helm/pkg/proto/hapi/release"
)
...
...
@@ -129,5 +131,5 @@ func newRecord(key string, rls *rspb.Release) *record {
lbs
.
set
(
"STATUS"
,
rspb
.
Status_Code_name
[
int32
(
rls
.
Info
.
Status
.
Code
)])
lbs
.
set
(
"VERSION"
,
strconv
.
Itoa
(
int
(
rls
.
Version
)))
return
&
record
{
key
:
key
,
lbs
:
lbs
,
rls
:
rls
}
return
&
record
{
key
:
key
,
lbs
:
lbs
,
rls
:
proto
.
Clone
(
rls
)
.
(
*
rspb
.
Release
)
}
}
pkg/tiller/release_update_test.go
View file @
0f18f35d
...
...
@@ -20,6 +20,8 @@ import (
"strings"
"testing"
"github.com/golang/protobuf/proto"
"k8s.io/helm/pkg/helm"
"k8s.io/helm/pkg/proto/hapi/chart"
"k8s.io/helm/pkg/proto/hapi/release"
...
...
@@ -59,10 +61,7 @@ func TestUpdateRelease(t *testing.T) {
t
.
Errorf
(
"Expected release namespace '%s', got '%s'."
,
rel
.
Namespace
,
res
.
Release
.
Namespace
)
}
updated
,
err
:=
rs
.
env
.
Releases
.
Get
(
res
.
Release
.
Name
,
res
.
Release
.
Version
)
if
err
!=
nil
{
t
.
Errorf
(
"Expected release for %s (%v)."
,
res
.
Release
.
Name
,
rs
.
env
.
Releases
)
}
updated
:=
compareStoredAndReturnedRelease
(
t
,
*
rs
,
*
res
)
if
len
(
updated
.
Hooks
)
!=
1
{
t
.
Fatalf
(
"Expected 1 hook, got %d"
,
len
(
updated
.
Hooks
))
...
...
@@ -79,8 +78,8 @@ func TestUpdateRelease(t *testing.T) {
t
.
Errorf
(
"Expected event 0 to be pre upgrade"
)
}
if
len
(
res
.
Release
.
Manifest
)
==
0
{
t
.
Errorf
(
"
No manifest returned: %v"
,
res
.
Release
)
if
len
(
updated
.
Manifest
)
==
0
{
t
.
Errorf
(
"
Expected manifest in %v"
,
res
)
}
if
res
.
Release
.
Config
==
nil
{
...
...
@@ -89,12 +88,8 @@ func TestUpdateRelease(t *testing.T) {
t
.
Errorf
(
"Expected release values %q, got %q"
,
rel
.
Config
.
Raw
,
res
.
Release
.
Config
.
Raw
)
}
if
len
(
updated
.
Manifest
)
==
0
{
t
.
Errorf
(
"Expected manifest in %v"
,
res
)
}
if
!
strings
.
Contains
(
updated
.
Manifest
,
"---
\n
# Source: hello/templates/hello
\n
hello: world"
)
{
t
.
Errorf
(
"unexpected output: %s"
,
rel
.
Manifest
)
t
.
Errorf
(
"unexpected output: %s"
,
updated
.
Manifest
)
}
if
res
.
Release
.
Version
!=
2
{
...
...
@@ -167,6 +162,7 @@ func TestUpdateRelease_ReuseValues(t *testing.T) {
if
res
.
Release
.
Config
!=
nil
&&
res
.
Release
.
Config
.
Raw
!=
expect
{
t
.
Errorf
(
"Expected request config to be %q, got %q"
,
expect
,
res
.
Release
.
Config
.
Raw
)
}
compareStoredAndReturnedRelease
(
t
,
*
rs
,
*
res
)
}
func
TestUpdateRelease_ResetReuseValues
(
t
*
testing
.
T
)
{
...
...
@@ -196,6 +192,7 @@ func TestUpdateRelease_ResetReuseValues(t *testing.T) {
if
res
.
Release
.
Config
!=
nil
&&
res
.
Release
.
Config
.
Raw
!=
""
{
t
.
Errorf
(
"Expected chart config to be empty, got %q"
,
res
.
Release
.
Config
.
Raw
)
}
compareStoredAndReturnedRelease
(
t
,
*
rs
,
*
res
)
}
func
TestUpdateReleaseFailure
(
t
*
testing
.
T
)
{
...
...
@@ -204,6 +201,7 @@ func TestUpdateReleaseFailure(t *testing.T) {
rel
:=
releaseStub
()
rs
.
env
.
Releases
.
Create
(
rel
)
rs
.
env
.
KubeClient
=
newUpdateFailingKubeClient
()
rs
.
Log
=
t
.
Logf
req
:=
&
services
.
UpdateReleaseRequest
{
Name
:
rel
.
Name
,
...
...
@@ -225,6 +223,8 @@ func TestUpdateReleaseFailure(t *testing.T) {
t
.
Errorf
(
"Expected FAILED release. Got %d"
,
updatedStatus
)
}
compareStoredAndReturnedRelease
(
t
,
*
rs
,
*
res
)
edesc
:=
"Upgrade
\"
angry-panda
\"
failed: Failed update in kube client"
if
got
:=
res
.
Release
.
Info
.
Description
;
got
!=
edesc
{
t
.
Errorf
(
"Expected description %q, got %q"
,
edesc
,
got
)
...
...
@@ -285,3 +285,16 @@ func TestUpdateReleaseNoChanges(t *testing.T) {
t
.
Fatalf
(
"Failed updated: %s"
,
err
)
}
}
func
compareStoredAndReturnedRelease
(
t
*
testing
.
T
,
rs
ReleaseServer
,
res
services
.
UpdateReleaseResponse
)
*
release
.
Release
{
storedRelease
,
err
:=
rs
.
env
.
Releases
.
Get
(
res
.
Release
.
Name
,
res
.
Release
.
Version
)
if
err
!=
nil
{
t
.
Fatalf
(
"Expected release for %s (%v)."
,
res
.
Release
.
Name
,
rs
.
env
.
Releases
)
}
if
!
proto
.
Equal
(
storedRelease
,
res
.
Release
)
{
t
.
Errorf
(
"Stored release doesn't match returned Release"
)
}
return
storedRelease
}
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