Commit 5b7e841f authored by fibonacci1729's avatar fibonacci1729

chore(tiller): delete redundant testing of storage in pkg/environment

parent b74251f6
......@@ -23,9 +23,6 @@ import (
"k8s.io/helm/pkg/chartutil"
"k8s.io/helm/pkg/proto/hapi/chart"
"k8s.io/helm/pkg/proto/hapi/release"
"k8s.io/helm/pkg/storage"
"k8s.io/helm/pkg/storage/driver"
unversionedclient "k8s.io/kubernetes/pkg/client/unversioned"
"k8s.io/kubernetes/pkg/client/unversioned/testclient"
)
......@@ -38,52 +35,6 @@ func (e *mockEngine) Render(chrt *chart.Chart, v chartutil.Values) (map[string]s
return e.out, nil
}
type mockReleaseStorage struct {
rel *release.Release
}
var _ driver.Driver = (*mockReleaseStorage)(nil)
func (r *mockReleaseStorage) Create(v *release.Release) error {
r.rel = v
return nil
}
func (r *mockReleaseStorage) Name() string {
return "mockReleaseStorage"
}
func (r *mockReleaseStorage) Get(k string) (*release.Release, error) {
return r.rel, nil
}
func (r *mockReleaseStorage) Update(v *release.Release) error {
r.rel = v
return nil
}
func (r *mockReleaseStorage) Delete(k string) (*release.Release, error) {
return r.rel, nil
}
func (r *mockReleaseStorage) List(func(*release.Release) bool) ([]*release.Release, error) {
return []*release.Release{}, nil
}
func (r *mockReleaseStorage) Query(labels map[string]string) ([]*release.Release, error) {
return []*release.Release{}, nil
}
func (r *mockReleaseStorage) History(n string) ([]*release.Release, error) {
res := []*release.Release{}
rel, err := r.Get(n)
if err != nil {
return res, err
}
res = append(res, rel)
return res, nil
}
type mockKubeClient struct {
}
......@@ -126,32 +77,6 @@ func TestEngine(t *testing.T) {
}
}
func TestReleaseStorage(t *testing.T) {
rs := &mockReleaseStorage{}
env := New()
env.Releases = storage.Init(rs)
release := &release.Release{Name: "mariner"}
if err := env.Releases.Create(release); err != nil {
t.Fatalf("failed to store release: %s", err)
}
if err := env.Releases.Update(release); err != nil {
t.Fatalf("failed to update release: %s", err)
}
if v, err := env.Releases.Get("albatross"); err != nil {
t.Errorf("Error fetching release: %s", err)
} else if v.Name != "mariner" {
t.Errorf("Expected mariner, got %q", v.Name)
}
if _, err := env.Releases.Delete("albatross"); err != nil {
t.Fatalf("failed to delete release: %s", err)
}
}
func TestKubeClient(t *testing.T) {
kc := &mockKubeClient{}
env := New()
......
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