Signed-off-by: Soujanya Mangipudi <somangip@microsoft.com>
pull/11322/head
Soujanya Mangipudi 3 years ago
parent 49714766af
commit f58bc39614

@ -130,7 +130,7 @@ func (s statusPrinter) WriteTable(out io.Writer) error {
fmt.Fprintf(out, "DESCRIPTION: %s\n", s.release.Info.Description) fmt.Fprintf(out, "DESCRIPTION: %s\n", s.release.Info.Description)
} }
if s.showResources && len(s.release.Info.Resources) > 0 { if s.showResources && s.release.Info.Resources != nil && len(s.release.Info.Resources) > 0 {
buf := new(bytes.Buffer) buf := new(bytes.Buffer)
printFlags := get.NewHumanPrintFlags() printFlags := get.NewHumanPrintFlags()
typePrinter, _ := printFlags.ToPrinter("") typePrinter, _ := printFlags.ToPrinter("")

@ -19,9 +19,7 @@ package main
import ( import (
"testing" "testing"
"time" "time"
"k8s.io/apimachinery/pkg/runtime"
"helm.sh/helm/v3/pkg/chart" "helm.sh/helm/v3/pkg/chart"
"helm.sh/helm/v3/pkg/release" "helm.sh/helm/v3/pkg/release"
helmtime "helm.sh/helm/v3/pkg/time" helmtime "helm.sh/helm/v3/pkg/time"
@ -76,9 +74,6 @@ func TestStatusCmd(t *testing.T) {
golden: "output/status-with-resources.txt", golden: "output/status-with-resources.txt",
rels: releasesMockWithStatus( rels: releasesMockWithStatus(
&release.Info{ &release.Info{
Resources: map[string][]runtime.Object{
"test": {},
},
Status: release.StatusDeployed, Status: release.StatusDeployed,
}, },
), ),
@ -87,10 +82,7 @@ func TestStatusCmd(t *testing.T) {
cmd: "status --show-resources flummoxed-chickadee -o json", cmd: "status --show-resources flummoxed-chickadee -o json",
golden: "output/status-with-resources.json", golden: "output/status-with-resources.json",
rels: releasesMockWithStatus( rels: releasesMockWithStatus(
&release.Info{ &release.Info{
Resources: map[string][]runtime.Object{
"test": {},
},
Status: release.StatusDeployed, Status: release.StatusDeployed,
}, },
), ),

@ -1 +1 @@
{"name":"flummoxed-chickadee","info":{"first_deployed":"","last_deployed":"2016-01-16T00:00:00Z","deleted":"","status":"deployed","resources":{"test":[]}},"namespace":"default"} {"name":"flummoxed-chickadee","info":{"first_deployed":"","last_deployed":"2016-01-16T00:00:00Z","deleted":"","status":"deployed"},"namespace":"default"}

@ -3,7 +3,4 @@ LAST DEPLOYED: Sat Jan 16 00:00:00 2016
NAMESPACE: default NAMESPACE: default
STATUS: deployed STATUS: deployed
REVISION: 0 REVISION: 0
RESOURCES:
==> test
TEST SUITE: None TEST SUITE: None

@ -22,6 +22,7 @@ import (
"time" "time"
v1 "k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/cli-runtime/pkg/resource" "k8s.io/cli-runtime/pkg/resource"
"helm.sh/helm/v3/pkg/kube" "helm.sh/helm/v3/pkg/kube"
@ -50,9 +51,9 @@ func (p *PrintingKubeClient) Create(resources kube.ResourceList) (*kube.Result,
func (p *PrintingKubeClient) Get(resources kube.ResourceList, reader io.Reader) (string, error) { func (p *PrintingKubeClient) Get(resources kube.ResourceList, reader io.Reader) (string, error) {
_, err := io.Copy(p.Out, bufferize(resources)) _, err := io.Copy(p.Out, bufferize(resources))
if err != nil { if err != nil {
return "", err return nil, err
} }
return "", nil return make(map[string][]runtime.Object), nil
} }
func (p *PrintingKubeClient) Wait(resources kube.ResourceList, _ time.Duration) error { func (p *PrintingKubeClient) Wait(resources kube.ResourceList, _ time.Duration) error {

Loading…
Cancel
Save