|
|
|
@ -25,93 +25,6 @@ import (
|
|
|
|
|
"k8s.io/helm/pkg/hapi/release"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func TestFakeClient_ReleaseStatus(t *testing.T) {
|
|
|
|
|
releasePresent := ReleaseMock(&MockReleaseOptions{Name: "release-present"})
|
|
|
|
|
releaseNotPresent := ReleaseMock(&MockReleaseOptions{Name: "release-not-present"})
|
|
|
|
|
|
|
|
|
|
type fields struct {
|
|
|
|
|
Rels []*release.Release
|
|
|
|
|
}
|
|
|
|
|
type args struct {
|
|
|
|
|
rlsName string
|
|
|
|
|
}
|
|
|
|
|
tests := []struct {
|
|
|
|
|
name string
|
|
|
|
|
fields fields
|
|
|
|
|
args args
|
|
|
|
|
want *hapi.GetReleaseStatusResponse
|
|
|
|
|
wantErr bool
|
|
|
|
|
}{
|
|
|
|
|
{
|
|
|
|
|
name: "Get a single release that exists",
|
|
|
|
|
fields: fields{
|
|
|
|
|
Rels: []*release.Release{
|
|
|
|
|
releasePresent,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
args: args{
|
|
|
|
|
rlsName: releasePresent.Name,
|
|
|
|
|
},
|
|
|
|
|
want: &hapi.GetReleaseStatusResponse{
|
|
|
|
|
Name: releasePresent.Name,
|
|
|
|
|
Info: releasePresent.Info,
|
|
|
|
|
Namespace: releasePresent.Namespace,
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
wantErr: false,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: "Get a release that does not exist",
|
|
|
|
|
fields: fields{
|
|
|
|
|
Rels: []*release.Release{
|
|
|
|
|
releasePresent,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
args: args{
|
|
|
|
|
rlsName: releaseNotPresent.Name,
|
|
|
|
|
},
|
|
|
|
|
want: nil,
|
|
|
|
|
wantErr: true,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: "Get a single release that exists from list",
|
|
|
|
|
fields: fields{
|
|
|
|
|
Rels: []*release.Release{
|
|
|
|
|
ReleaseMock(&MockReleaseOptions{Name: "angry-dolphin", Namespace: "default"}),
|
|
|
|
|
ReleaseMock(&MockReleaseOptions{Name: "trepid-tapir", Namespace: "default"}),
|
|
|
|
|
releasePresent,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
args: args{
|
|
|
|
|
rlsName: releasePresent.Name,
|
|
|
|
|
},
|
|
|
|
|
want: &hapi.GetReleaseStatusResponse{
|
|
|
|
|
Name: releasePresent.Name,
|
|
|
|
|
Info: releasePresent.Info,
|
|
|
|
|
Namespace: releasePresent.Namespace,
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
wantErr: false,
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for _, tt := range tests {
|
|
|
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
|
|
|
c := &FakeClient{
|
|
|
|
|
Rels: tt.fields.Rels,
|
|
|
|
|
}
|
|
|
|
|
got, err := c.ReleaseStatus(tt.args.rlsName, 0)
|
|
|
|
|
if (err != nil) != tt.wantErr {
|
|
|
|
|
t.Errorf("FakeClient.ReleaseStatus() error = %v, wantErr %v", err, tt.wantErr)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if !reflect.DeepEqual(got, tt.want) {
|
|
|
|
|
t.Errorf("FakeClient.ReleaseStatus() = %v, want %v", got, tt.want)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestFakeClient_InstallReleaseFromChart(t *testing.T) {
|
|
|
|
|
installChart := &chart.Chart{}
|
|
|
|
|
type fields struct {
|
|
|
|
|