mirror of https://github.com/helm/helm
TestRunReleaseTest -> tiller/release_testing_test.go TestGetReleaseContent -> tiller/release_content_test.go TestGetReleaseStatusDeleted -> tiller/release_status_test.go TestGetReleaseStatus -> tiller/release_status_test.go TestRollbackReleaseFailure -> tiller/release_rollback_test.go TestRollbackReleaseNoHooks -> tiller/release_rollback_test.go TestRollbackRelease -> tiller/release_rollback_test.go TestUninstallReleaseWithKeepPolicy -> tiller/release_uninstall_test.go TestUninstallPurgeDeleteRelease -> tiller/release_uninstall_test.go TestUninstallReleaseNoHooks -> tiller/release_uninstall_test.go TestUninstallPurgeRelease -> tiller/release_uninstall_test.go TestUninstallRelease -> tiller/release_uninstall_test.gopull/2484/head
parent
fcf48f430b
commit
172dbb22cf
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package tiller
|
||||||
|
|
||||||
|
import (
|
||||||
|
"k8s.io/helm/pkg/helm"
|
||||||
|
"k8s.io/helm/pkg/proto/hapi/services"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestGetReleaseContent(t *testing.T) {
|
||||||
|
c := helm.NewContext()
|
||||||
|
rs := rsFixture()
|
||||||
|
rel := releaseStub()
|
||||||
|
if err := rs.env.Releases.Create(rel); err != nil {
|
||||||
|
t.Fatalf("Could not store mock release: %s", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
res, err := rs.GetReleaseContent(c, &services.GetReleaseContentRequest{Name: rel.Name, Version: 1})
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("Error getting release content: %s", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if res.Release.Chart.Metadata.Name != rel.Chart.Metadata.Name {
|
||||||
|
t.Errorf("Expected %q, got %q", rel.Chart.Metadata.Name, res.Release.Chart.Metadata.Name)
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,193 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package tiller
|
||||||
|
|
||||||
|
import (
|
||||||
|
"k8s.io/helm/pkg/helm"
|
||||||
|
"k8s.io/helm/pkg/proto/hapi/release"
|
||||||
|
"k8s.io/helm/pkg/proto/hapi/services"
|
||||||
|
"strings"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestRollbackRelease(t *testing.T) {
|
||||||
|
c := helm.NewContext()
|
||||||
|
rs := rsFixture()
|
||||||
|
rel := releaseStub()
|
||||||
|
rs.env.Releases.Create(rel)
|
||||||
|
upgradedRel := upgradeReleaseVersion(rel)
|
||||||
|
upgradedRel.Hooks = []*release.Hook{
|
||||||
|
{
|
||||||
|
Name: "test-cm",
|
||||||
|
Kind: "ConfigMap",
|
||||||
|
Path: "test-cm",
|
||||||
|
Manifest: manifestWithRollbackHooks,
|
||||||
|
Events: []release.Hook_Event{
|
||||||
|
release.Hook_PRE_ROLLBACK,
|
||||||
|
release.Hook_POST_ROLLBACK,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
upgradedRel.Manifest = "hello world"
|
||||||
|
rs.env.Releases.Update(rel)
|
||||||
|
rs.env.Releases.Create(upgradedRel)
|
||||||
|
|
||||||
|
req := &services.RollbackReleaseRequest{
|
||||||
|
Name: rel.Name,
|
||||||
|
}
|
||||||
|
res, err := rs.RollbackRelease(c, req)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("Failed rollback: %s", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if res.Release.Name == "" {
|
||||||
|
t.Errorf("Expected release name.")
|
||||||
|
}
|
||||||
|
|
||||||
|
if res.Release.Name != rel.Name {
|
||||||
|
t.Errorf("Updated release name does not match previous release name. Expected %s, got %s", rel.Name, res.Release.Name)
|
||||||
|
}
|
||||||
|
|
||||||
|
if res.Release.Namespace != rel.Namespace {
|
||||||
|
t.Errorf("Expected release namespace '%s', got '%s'.", rel.Namespace, res.Release.Namespace)
|
||||||
|
}
|
||||||
|
|
||||||
|
if res.Release.Version != 3 {
|
||||||
|
t.Errorf("Expected release version to be %v, got %v", 3, res.Release.Version)
|
||||||
|
}
|
||||||
|
|
||||||
|
updated, err := rs.env.Releases.Get(res.Release.Name, res.Release.Version)
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("Expected release for %s (%v).", res.Release.Name, rs.env.Releases)
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(updated.Hooks) != 2 {
|
||||||
|
t.Fatalf("Expected 2 hooks, got %d", len(updated.Hooks))
|
||||||
|
}
|
||||||
|
|
||||||
|
if updated.Hooks[0].Manifest != manifestWithHook {
|
||||||
|
t.Errorf("Unexpected manifest: %v", updated.Hooks[0].Manifest)
|
||||||
|
}
|
||||||
|
|
||||||
|
anotherUpgradedRelease := upgradeReleaseVersion(upgradedRel)
|
||||||
|
rs.env.Releases.Update(upgradedRel)
|
||||||
|
rs.env.Releases.Create(anotherUpgradedRelease)
|
||||||
|
|
||||||
|
res, err = rs.RollbackRelease(c, req)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("Failed rollback: %s", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
updated, err = rs.env.Releases.Get(res.Release.Name, res.Release.Version)
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("Expected release for %s (%v).", res.Release.Name, rs.env.Releases)
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(updated.Hooks) != 1 {
|
||||||
|
t.Fatalf("Expected 1 hook, got %d", len(updated.Hooks))
|
||||||
|
}
|
||||||
|
|
||||||
|
if updated.Hooks[0].Manifest != manifestWithRollbackHooks {
|
||||||
|
t.Errorf("Unexpected manifest: %v", updated.Hooks[0].Manifest)
|
||||||
|
}
|
||||||
|
|
||||||
|
if res.Release.Version != 4 {
|
||||||
|
t.Errorf("Expected release version to be %v, got %v", 3, res.Release.Version)
|
||||||
|
}
|
||||||
|
|
||||||
|
if updated.Hooks[0].Events[0] != release.Hook_PRE_ROLLBACK {
|
||||||
|
t.Errorf("Expected event 0 to be pre rollback")
|
||||||
|
}
|
||||||
|
|
||||||
|
if updated.Hooks[0].Events[1] != release.Hook_POST_ROLLBACK {
|
||||||
|
t.Errorf("Expected event 1 to be post rollback")
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(res.Release.Manifest) == 0 {
|
||||||
|
t.Errorf("No manifest returned: %v", res.Release)
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(updated.Manifest) == 0 {
|
||||||
|
t.Errorf("Expected manifest in %v", res)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !strings.Contains(updated.Manifest, "hello world") {
|
||||||
|
t.Errorf("unexpected output: %s", rel.Manifest)
|
||||||
|
}
|
||||||
|
|
||||||
|
if res.Release.Info.Description != "Rollback to 2" {
|
||||||
|
t.Errorf("Expected rollback to 2, got %q", res.Release.Info.Description)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestRollbackWithReleaseVersion(t *testing.T) {
|
||||||
|
c := helm.NewContext()
|
||||||
|
rs := rsFixture()
|
||||||
|
rel := releaseStub()
|
||||||
|
rs.env.Releases.Create(rel)
|
||||||
|
upgradedRel := upgradeReleaseVersion(rel)
|
||||||
|
rs.env.Releases.Update(rel)
|
||||||
|
rs.env.Releases.Create(upgradedRel)
|
||||||
|
|
||||||
|
req := &services.RollbackReleaseRequest{
|
||||||
|
Name: rel.Name,
|
||||||
|
DisableHooks: true,
|
||||||
|
Version: 1,
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err := rs.RollbackRelease(c, req)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("Failed rollback: %s", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestRollbackReleaseNoHooks(t *testing.T) {
|
||||||
|
c := helm.NewContext()
|
||||||
|
rs := rsFixture()
|
||||||
|
rel := releaseStub()
|
||||||
|
rel.Hooks = []*release.Hook{
|
||||||
|
{
|
||||||
|
Name: "test-cm",
|
||||||
|
Kind: "ConfigMap",
|
||||||
|
Path: "test-cm",
|
||||||
|
Manifest: manifestWithRollbackHooks,
|
||||||
|
Events: []release.Hook_Event{
|
||||||
|
release.Hook_PRE_ROLLBACK,
|
||||||
|
release.Hook_POST_ROLLBACK,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
rs.env.Releases.Create(rel)
|
||||||
|
upgradedRel := upgradeReleaseVersion(rel)
|
||||||
|
rs.env.Releases.Update(rel)
|
||||||
|
rs.env.Releases.Create(upgradedRel)
|
||||||
|
|
||||||
|
req := &services.RollbackReleaseRequest{
|
||||||
|
Name: rel.Name,
|
||||||
|
DisableHooks: true,
|
||||||
|
}
|
||||||
|
|
||||||
|
res, err := rs.RollbackRelease(c, req)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("Failed rollback: %s", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if hl := res.Release.Hooks[0].LastRun; hl != nil {
|
||||||
|
t.Errorf("Expected that no hooks were run. Got %d", hl)
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,64 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package tiller
|
||||||
|
|
||||||
|
import (
|
||||||
|
"k8s.io/helm/pkg/helm"
|
||||||
|
"k8s.io/helm/pkg/proto/hapi/release"
|
||||||
|
"k8s.io/helm/pkg/proto/hapi/services"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestGetReleaseStatus(t *testing.T) {
|
||||||
|
c := helm.NewContext()
|
||||||
|
rs := rsFixture()
|
||||||
|
rel := releaseStub()
|
||||||
|
if err := rs.env.Releases.Create(rel); err != nil {
|
||||||
|
t.Fatalf("Could not store mock release: %s", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
res, err := rs.GetReleaseStatus(c, &services.GetReleaseStatusRequest{Name: rel.Name, Version: 1})
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("Error getting release content: %s", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if res.Name != rel.Name {
|
||||||
|
t.Errorf("Expected name %q, got %q", rel.Name, res.Name)
|
||||||
|
}
|
||||||
|
if res.Info.Status.Code != release.Status_DEPLOYED {
|
||||||
|
t.Errorf("Expected %d, got %d", release.Status_DEPLOYED, res.Info.Status.Code)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestGetReleaseStatusDeleted(t *testing.T) {
|
||||||
|
c := helm.NewContext()
|
||||||
|
rs := rsFixture()
|
||||||
|
rel := releaseStub()
|
||||||
|
rel.Info.Status.Code = release.Status_DELETED
|
||||||
|
if err := rs.env.Releases.Create(rel); err != nil {
|
||||||
|
t.Fatalf("Could not store mock release: %s", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
res, err := rs.GetReleaseStatus(c, &services.GetReleaseStatusRequest{Name: rel.Name, Version: 1})
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("Error getting release content: %s", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if res.Info.Status.Code != release.Status_DELETED {
|
||||||
|
t.Errorf("Expected %d, got %d", release.Status_DELETED, res.Info.Status.Code)
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package tiller
|
||||||
|
|
||||||
|
import (
|
||||||
|
"k8s.io/helm/pkg/proto/hapi/release"
|
||||||
|
"k8s.io/helm/pkg/proto/hapi/services"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestRunReleaseTest(t *testing.T) {
|
||||||
|
rs := rsFixture()
|
||||||
|
rel := namedReleaseStub("nemo", release.Status_DEPLOYED)
|
||||||
|
rs.env.Releases.Create(rel)
|
||||||
|
|
||||||
|
req := &services.TestReleaseRequest{Name: "nemo", Timeout: 2}
|
||||||
|
err := rs.RunReleaseTest(req, mockRunReleaseTestServer{})
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("failed to run release tests on %s: %s", rel.Name, err)
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,177 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package tiller
|
||||||
|
|
||||||
|
import (
|
||||||
|
"k8s.io/helm/pkg/helm"
|
||||||
|
"k8s.io/helm/pkg/proto/hapi/release"
|
||||||
|
"k8s.io/helm/pkg/proto/hapi/services"
|
||||||
|
"strings"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestUninstallRelease(t *testing.T) {
|
||||||
|
c := helm.NewContext()
|
||||||
|
rs := rsFixture()
|
||||||
|
rs.env.Releases.Create(releaseStub())
|
||||||
|
|
||||||
|
req := &services.UninstallReleaseRequest{
|
||||||
|
Name: "angry-panda",
|
||||||
|
}
|
||||||
|
|
||||||
|
res, err := rs.UninstallRelease(c, req)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("Failed uninstall: %s", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if res.Release.Name != "angry-panda" {
|
||||||
|
t.Errorf("Expected angry-panda, got %q", res.Release.Name)
|
||||||
|
}
|
||||||
|
|
||||||
|
if res.Release.Info.Status.Code != release.Status_DELETED {
|
||||||
|
t.Errorf("Expected status code to be DELETED, got %d", res.Release.Info.Status.Code)
|
||||||
|
}
|
||||||
|
|
||||||
|
if res.Release.Hooks[0].LastRun.Seconds == 0 {
|
||||||
|
t.Error("Expected LastRun to be greater than zero.")
|
||||||
|
}
|
||||||
|
|
||||||
|
if res.Release.Info.Deleted.Seconds <= 0 {
|
||||||
|
t.Errorf("Expected valid UNIX date, got %d", res.Release.Info.Deleted.Seconds)
|
||||||
|
}
|
||||||
|
|
||||||
|
if res.Release.Info.Description != "Deletion complete" {
|
||||||
|
t.Errorf("Expected Deletion complete, got %q", res.Release.Info.Description)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestUninstallPurgeRelease(t *testing.T) {
|
||||||
|
c := helm.NewContext()
|
||||||
|
rs := rsFixture()
|
||||||
|
rel := releaseStub()
|
||||||
|
rs.env.Releases.Create(rel)
|
||||||
|
upgradedRel := upgradeReleaseVersion(rel)
|
||||||
|
rs.env.Releases.Update(rel)
|
||||||
|
rs.env.Releases.Create(upgradedRel)
|
||||||
|
|
||||||
|
req := &services.UninstallReleaseRequest{
|
||||||
|
Name: "angry-panda",
|
||||||
|
Purge: true,
|
||||||
|
}
|
||||||
|
|
||||||
|
res, err := rs.UninstallRelease(c, req)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("Failed uninstall: %s", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if res.Release.Name != "angry-panda" {
|
||||||
|
t.Errorf("Expected angry-panda, got %q", res.Release.Name)
|
||||||
|
}
|
||||||
|
|
||||||
|
if res.Release.Info.Status.Code != release.Status_DELETED {
|
||||||
|
t.Errorf("Expected status code to be DELETED, got %d", res.Release.Info.Status.Code)
|
||||||
|
}
|
||||||
|
|
||||||
|
if res.Release.Info.Deleted.Seconds <= 0 {
|
||||||
|
t.Errorf("Expected valid UNIX date, got %d", res.Release.Info.Deleted.Seconds)
|
||||||
|
}
|
||||||
|
rels, err := rs.GetHistory(helm.NewContext(), &services.GetHistoryRequest{Name: "angry-panda"})
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
if len(rels.Releases) != 0 {
|
||||||
|
t.Errorf("Expected no releases in storage, got %d", len(rels.Releases))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestUninstallPurgeDeleteRelease(t *testing.T) {
|
||||||
|
c := helm.NewContext()
|
||||||
|
rs := rsFixture()
|
||||||
|
rs.env.Releases.Create(releaseStub())
|
||||||
|
|
||||||
|
req := &services.UninstallReleaseRequest{
|
||||||
|
Name: "angry-panda",
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err := rs.UninstallRelease(c, req)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("Failed uninstall: %s", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
req2 := &services.UninstallReleaseRequest{
|
||||||
|
Name: "angry-panda",
|
||||||
|
Purge: true,
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err2 := rs.UninstallRelease(c, req2)
|
||||||
|
if err2 != nil && err2.Error() != "'angry-panda' has no deployed releases" {
|
||||||
|
t.Errorf("Failed uninstall: %s", err2)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestUninstallReleaseWithKeepPolicy(t *testing.T) {
|
||||||
|
c := helm.NewContext()
|
||||||
|
rs := rsFixture()
|
||||||
|
name := "angry-bunny"
|
||||||
|
rs.env.Releases.Create(releaseWithKeepStub(name))
|
||||||
|
|
||||||
|
req := &services.UninstallReleaseRequest{
|
||||||
|
Name: name,
|
||||||
|
}
|
||||||
|
|
||||||
|
res, err := rs.UninstallRelease(c, req)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("Failed uninstall: %s", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if res.Release.Name != name {
|
||||||
|
t.Errorf("Expected angry-bunny, got %q", res.Release.Name)
|
||||||
|
}
|
||||||
|
|
||||||
|
if res.Release.Info.Status.Code != release.Status_DELETED {
|
||||||
|
t.Errorf("Expected status code to be DELETED, got %d", res.Release.Info.Status.Code)
|
||||||
|
}
|
||||||
|
|
||||||
|
if res.Info == "" {
|
||||||
|
t.Errorf("Expected response info to not be empty")
|
||||||
|
} else {
|
||||||
|
if !strings.Contains(res.Info, "[ConfigMap] test-cm-keep") {
|
||||||
|
t.Errorf("unexpected output: %s", res.Info)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestUninstallReleaseNoHooks(t *testing.T) {
|
||||||
|
c := helm.NewContext()
|
||||||
|
rs := rsFixture()
|
||||||
|
rs.env.Releases.Create(releaseStub())
|
||||||
|
|
||||||
|
req := &services.UninstallReleaseRequest{
|
||||||
|
Name: "angry-panda",
|
||||||
|
DisableHooks: true,
|
||||||
|
}
|
||||||
|
|
||||||
|
res, err := rs.UninstallRelease(c, req)
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("Failed uninstall: %s", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// The default value for a protobuf timestamp is nil.
|
||||||
|
if res.Release.Hooks[0].LastRun != nil {
|
||||||
|
t.Errorf("Expected LastRun to be zero, got %d.", res.Release.Hooks[0].LastRun.Seconds)
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue