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
3dca6994
Commit
3dca6994
authored
Aug 09, 2016
by
fibonacci1729
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: storage tests
parent
3a6a9f24
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
2 deletions
+13
-2
storage.go
pkg/storage/storage.go
+1
-0
storage_test.go
pkg/storage/storage_test.go
+12
-2
No files found.
pkg/storage/storage.go
View file @
3dca6994
...
@@ -107,6 +107,7 @@ func (s *Storage) ListFilterAny(filters ...FilterFunc) ([]*rspb.Release, error)
...
@@ -107,6 +107,7 @@ func (s *Storage) ListFilterAny(filters ...FilterFunc) ([]*rspb.Release, error)
// Init initializes a new storage backend with the driver d.
// Init initializes a new storage backend with the driver d.
// If d is nil, the default in-memory driver is used.
// If d is nil, the default in-memory driver is used.
func
Init
(
d
driver
.
Driver
)
*
Storage
{
func
Init
(
d
driver
.
Driver
)
*
Storage
{
// default driver is in memory
if
d
==
nil
{
if
d
==
nil
{
d
=
driver
.
NewMemory
()
d
=
driver
.
NewMemory
()
}
}
...
...
pkg/storage/storage_test.go
View file @
3dca6994
...
@@ -25,9 +25,10 @@ import (
...
@@ -25,9 +25,10 @@ import (
"k8s.io/helm/pkg/storage/driver"
"k8s.io/helm/pkg/storage/driver"
)
)
var
storage
=
Init
(
driver
.
NewMemory
())
func
TestStorageCreate
(
t
*
testing
.
T
)
{
func
TestStorageCreate
(
t
*
testing
.
T
)
{
// initialize storage
storage
:=
Init
(
driver
.
NewMemory
())
// create fake release
// create fake release
rls
:=
ReleaseTestData
{
Name
:
"angry-beaver"
}
.
ToRelease
()
rls
:=
ReleaseTestData
{
Name
:
"angry-beaver"
}
.
ToRelease
()
assertErrNil
(
t
.
Fatal
,
storage
.
Create
(
rls
),
"StoreRelease"
)
assertErrNil
(
t
.
Fatal
,
storage
.
Create
(
rls
),
"StoreRelease"
)
...
@@ -43,6 +44,9 @@ func TestStorageCreate(t *testing.T) {
...
@@ -43,6 +44,9 @@ func TestStorageCreate(t *testing.T) {
}
}
func
TestStorageUpdate
(
t
*
testing
.
T
)
{
func
TestStorageUpdate
(
t
*
testing
.
T
)
{
// initialize storage
storage
:=
Init
(
driver
.
NewMemory
())
// create fake release
// create fake release
rls
:=
ReleaseTestData
{
Name
:
"angry-beaver"
}
.
ToRelease
()
rls
:=
ReleaseTestData
{
Name
:
"angry-beaver"
}
.
ToRelease
()
assertErrNil
(
t
.
Fatal
,
storage
.
Create
(
rls
),
"StoreRelease"
)
assertErrNil
(
t
.
Fatal
,
storage
.
Create
(
rls
),
"StoreRelease"
)
...
@@ -63,6 +67,9 @@ func TestStorageUpdate(t *testing.T) {
...
@@ -63,6 +67,9 @@ func TestStorageUpdate(t *testing.T) {
}
}
func
TestStorageDelete
(
t
*
testing
.
T
)
{
func
TestStorageDelete
(
t
*
testing
.
T
)
{
// initialize storage
storage
:=
Init
(
driver
.
NewMemory
())
// create fake release
// create fake release
rls
:=
ReleaseTestData
{
Name
:
"angry-beaver"
}
.
ToRelease
()
rls
:=
ReleaseTestData
{
Name
:
"angry-beaver"
}
.
ToRelease
()
assertErrNil
(
t
.
Fatal
,
storage
.
Create
(
rls
),
"StoreRelease"
)
assertErrNil
(
t
.
Fatal
,
storage
.
Create
(
rls
),
"StoreRelease"
)
...
@@ -78,6 +85,9 @@ func TestStorageDelete(t *testing.T) {
...
@@ -78,6 +85,9 @@ func TestStorageDelete(t *testing.T) {
}
}
func
TestStorageList
(
t
*
testing
.
T
)
{
func
TestStorageList
(
t
*
testing
.
T
)
{
// initialize storage
storage
:=
Init
(
driver
.
NewMemory
())
// setup storage with test releases
// setup storage with test releases
setup
:=
func
()
{
setup
:=
func
()
{
// release records
// release records
...
...
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