fix unit tests that I had b0rked before. Small code cleanup

pull/1122/head
vaikas-google 8 years ago
parent 406f0ab05c
commit 6b9c9c5743

@ -18,6 +18,7 @@ package main
import (
"bytes"
"fmt"
"io"
"math/rand"
"regexp"
@ -134,7 +135,14 @@ func (c *fakeReleaseClient) DeleteRelease(rlsName string, opts ...helm.DeleteOpt
}
func (c *fakeReleaseClient) ReleaseStatus(rlsName string, opts ...helm.StatusOption) (*rls.GetReleaseStatusResponse, error) {
return nil, nil
if c.rels[0] != nil {
return &rls.GetReleaseStatusResponse{
Name: c.rels[0].Name,
Info: c.rels[0].Info,
Namespace: c.rels[0].Namespace,
}, nil
}
return nil, fmt.Errorf("No such release: %s", rlsName)
}
func (c *fakeReleaseClient) UpdateRelease(rlsName string, chStr string, opts ...helm.UpdateOption) (*rls.UpdateReleaseResponse, error) {

@ -149,15 +149,18 @@ func (i *installCmd) run() error {
return prettyError(err)
}
i.printRelease(res.GetRelease())
rel := res.GetRelease()
if rel == nil {
return nil
}
i.printRelease(rel)
// Print the status like status command does
status, err := i.client.ReleaseStatus(res.GetRelease().Name)
status, err := i.client.ReleaseStatus(rel.Name)
if err != nil {
return prettyError(err)
}
PrintStatus(i.out, status)
return nil
}

@ -71,8 +71,12 @@ func (s *statusCmd) run() error {
return nil
}
// PrintStatus prints out the status of a release. Shared because also used by
// install / upgrade
func PrintStatus(out io.Writer, res *services.GetReleaseStatusResponse) {
fmt.Fprintf(out, "Last Deployed: %s\n", timeconv.String(res.Info.LastDeployed))
if res.Info.LastDeployed != nil {
fmt.Fprintf(out, "Last Deployed: %s\n", timeconv.String(res.Info.LastDeployed))
}
fmt.Fprintf(out, "Namespace: %s\n", res.Namespace)
fmt.Fprintf(out, "Status: %s\n", res.Info.Status.Code)
if res.Info.Status.Details != nil {

Loading…
Cancel
Save