Commit 3dca6994 authored by fibonacci1729's avatar fibonacci1729

fix: storage tests

parent 3a6a9f24
......@@ -107,6 +107,7 @@ func (s *Storage) ListFilterAny(filters ...FilterFunc) ([]*rspb.Release, error)
// Init initializes a new storage backend with the driver d.
// If d is nil, the default in-memory driver is used.
func Init(d driver.Driver) *Storage {
// default driver is in memory
if d == nil {
d = driver.NewMemory()
}
......
......@@ -25,9 +25,10 @@ import (
"k8s.io/helm/pkg/storage/driver"
)
var storage = Init(driver.NewMemory())
func TestStorageCreate(t *testing.T) {
// initialize storage
storage := Init(driver.NewMemory())
// create fake release
rls := ReleaseTestData{Name: "angry-beaver"}.ToRelease()
assertErrNil(t.Fatal, storage.Create(rls), "StoreRelease")
......@@ -43,6 +44,9 @@ func TestStorageCreate(t *testing.T) {
}
func TestStorageUpdate(t *testing.T) {
// initialize storage
storage := Init(driver.NewMemory())
// create fake release
rls := ReleaseTestData{Name: "angry-beaver"}.ToRelease()
assertErrNil(t.Fatal, storage.Create(rls), "StoreRelease")
......@@ -63,6 +67,9 @@ func TestStorageUpdate(t *testing.T) {
}
func TestStorageDelete(t *testing.T) {
// initialize storage
storage := Init(driver.NewMemory())
// create fake release
rls := ReleaseTestData{Name: "angry-beaver"}.ToRelease()
assertErrNil(t.Fatal, storage.Create(rls), "StoreRelease")
......@@ -78,6 +85,9 @@ func TestStorageDelete(t *testing.T) {
}
func TestStorageList(t *testing.T) {
// initialize storage
storage := Init(driver.NewMemory())
// setup storage with test releases
setup := func() {
// release records
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment