pull/1008/head
fibonacci1729 8 years ago
parent 4210d60c5e
commit aff817a1fc

@ -24,7 +24,7 @@ var (
// ErrReleaseNotFound indicates that a release is not found.
ErrReleaseNotFound = errors.New("release not found")
// Temporary error while WIP.
ErrNotImplemented = errors.New("not implemented")
ErrNotImplemented = errors.New("not implemented")
)
type Creator interface {
@ -50,4 +50,4 @@ type Driver interface {
Updator
Deletor
Queryor
}
}

@ -103,4 +103,4 @@ func (mem *Memory) rlock() func() {
}
}
func unlock(fn func()) { fn() }
func unlock(fn func()) { fn() }

@ -16,8 +16,8 @@ limitations under the License.
package driver // import "k8s.io/helm/pkg/storage/driver"
import (
"testing"
rspb "k8s.io/helm/pkg/proto/hapi/release"
"testing"
)
func TestMemoryGet(t *testing.T) {
@ -79,7 +79,7 @@ func TestMemoryDelete(t *testing.T) {
if err := mem.Create(rls); err != nil {
t.Fatalf("Failed create: %s", err)
}
res, err := mem.Delete(key)
switch {
case err != nil:
@ -89,4 +89,4 @@ func TestMemoryDelete(t *testing.T) {
case res.Info.Status.Code != release.Status_DELETED:
t.Errorf("Expected Status_DELETED, got %s", res.Info.Status.Code)
}
}
}

@ -16,8 +16,8 @@ limitations under the License.
package storage // import "k8s.io/helm/pkg/storage"
import (
"k8s.io/helm/pkg/storage/driver"
rspb "k8s.io/helm/pkg/proto/hapi/release"
"k8s.io/helm/pkg/storage/driver"
)
type Storage struct {
@ -45,4 +45,4 @@ func Init(drv driver.Driver) *Storage {
drv = driver.NewMemory()
}
return &Storage{drv: drv}
}
}

@ -17,12 +17,12 @@ package storage // import "k8s.io/helm/pkg/storage"
import (
"fmt"
"time"
"reflect"
"testing"
"time"
"k8s.io/helm/pkg/storage/driver"
rspb "k8s.io/helm/pkg/proto/hapi/release"
"k8s.io/helm/pkg/storage/driver"
tspb "github.com/golang/protobuf/ptypes"
)
@ -61,10 +61,10 @@ func TestStoreRelease(t *testing.T) {
t.Fatalf(fmt.Sprintf("Failed to %s: %q", msg, err))
}
}
rls := releaseData()
ckerr(storage.StoreRelease(rls), "StoreRelease")
res, err := storage.QueryRelease(rls.Name)
ckerr(err, "QueryRelease")
@ -79,10 +79,10 @@ func TestQueryRelease(t *testing.T) {
t.Fatalf(fmt.Sprintf("Failed to %s: %q", msg, err))
}
}
rls := releaseData()
ckerr(storage.StoreRelease(rls), "StoreRelease")
res, err := storage.QueryRelease(rls.Name)
ckerr(err, "QueryRelease")
@ -97,10 +97,10 @@ func TestDeleteRelease(t *testing.T) {
t.Fatalf(fmt.Sprintf("Failed to %s: %q", msg, err))
}
}
rls := releaseData()
ckerr(storage.StoreRelease(rls), "StoreRelease")
res, err := storage.DeleteRelease(rls.Name)
ckerr(err, "DeleteRelease")
@ -121,12 +121,12 @@ func TestUpdateRelease(t *testing.T) {
t.Fatalf(fmt.Sprintf("Failed to %s: %q", msg, err))
}
}
rls := releaseData()
ckerr(storage.StoreRelease(rls), "StoreRelease")
rls.Name = "hungry-hippo"
rls.Version = 2
rls.Name = "hungry-hippo"
rls.Version = 2
rls.Manifest = "old-manifest"
err := storage.UpdateRelease(rls)
@ -138,4 +138,4 @@ func TestUpdateRelease(t *testing.T) {
ckeql(res.Name, rls.Name, "Expected Name")
ckeql(res.Version, rls.Version, "Expected Version")
ckeql(res.Manifest, rls.Manifest, "Expected Manifest")
}
}

Loading…
Cancel
Save