Fixed issues reported by test-style

pull/2405/head
Sushil Kumar 7 years ago
parent 5c227bffbb
commit 61c3a44dc3

@ -88,6 +88,8 @@ test: test-unit
.PHONY: test-unit
test-unit:
@echo
@echo "==> Running unit tests <=="
HELM_HOME=/no/such/dir $(GO) test $(GOFLAGS) -run $(TESTS) $(PKG) $(TESTFLAGS)
.PHONY: test-style

@ -53,7 +53,7 @@ func newCompletionCmd(out io.Writer) *cobra.Command {
Short: "Generate autocompletions script for the specified shell (bash or zsh)",
Long: completionDesc,
RunE: func(cmd *cobra.Command, args []string) error {
return RunCompletion(out, cmd, args)
return runCompletion(out, cmd, args)
},
ValidArgs: shells,
}
@ -61,16 +61,16 @@ func newCompletionCmd(out io.Writer) *cobra.Command {
return cmd
}
func RunCompletion(out io.Writer, cmd *cobra.Command, args []string) error {
func runCompletion(out io.Writer, cmd *cobra.Command, args []string) error {
if len(args) == 0 {
return fmt.Errorf("Shell not specified.")
return fmt.Errorf("shell not specified")
}
if len(args) > 1 {
return fmt.Errorf("Too many arguments. Expected only the shell type.")
return fmt.Errorf("too many arguments, expected only the shell type")
}
run, found := completionShells[args[0]]
if !found {
return fmt.Errorf("Unsupported shell type %q.", args[0])
return fmt.Errorf("unsupported shell type %q", args[0])
}
return run(out, cmd)

@ -73,7 +73,7 @@ func newFetchCmd(out io.Writer) *cobra.Command {
Long: fetchDesc,
RunE: func(cmd *cobra.Command, args []string) error {
if len(args) == 0 {
return fmt.Errorf("This command needs at least one argument, url or repo/name of the chart.")
return fmt.Errorf("need at least one argument, url or repo/name of the chart")
}
for i := 0; i < len(args); i++ {
fch.chartRef = args[i]

@ -72,7 +72,7 @@ func newPackageCmd(out io.Writer) *cobra.Command {
RunE: func(cmd *cobra.Command, args []string) error {
pkg.home = settings.Home
if len(args) == 0 {
return fmt.Errorf("This command needs at least one argument, the path to the chart.")
return fmt.Errorf("need at least one argument, the path to the chart")
}
if pkg.sign {
if pkg.key == "" {

@ -64,7 +64,7 @@ func TestPackage(t *testing.T) {
name: "package without chart path",
args: []string{},
flags: map[string]string{},
expect: "This command needs at least one argument, the path to the chart.",
expect: "need at least one argument, the path to the chart",
err: true,
},
{

@ -85,7 +85,7 @@ func addRepository(name, url string, home helmpath.Home, certFile, keyFile, caFi
}
if noUpdate && f.Has(name) {
return fmt.Errorf("The repository name you provided (%s) already exists. Please specify a different name.", name)
return fmt.Errorf("repository name (%s) already exists, please specify a different name", name)
}
cif := home.CacheIndex(name)

@ -96,7 +96,7 @@ func (d *resetCmd) run() error {
}
if len(res.Releases) > 0 && !d.force {
return fmt.Errorf("There are still %d deployed releases (Tip: use --force).", len(res.Releases))
return fmt.Errorf("there are still %d deployed releases (Tip: use --force)", len(res.Releases))
}
if err := installer.Uninstall(d.kubeClient, &installer.Options{Namespace: d.namespace}); err != nil {

@ -120,7 +120,7 @@ func TestReset_deployedReleases(t *testing.T) {
namespace: api.NamespaceDefault,
}
err = cmd.run()
expected := "There are still 1 deployed releases (Tip: use --force)"
expected := "there are still 1 deployed releases (Tip: use --force)"
if !strings.Contains(err.Error(), expected) {
t.Errorf("unexpected error: %v", err)
}

@ -126,6 +126,7 @@ func (r *ReleaseModuleServiceServer) UpgradeRelease(ctx context.Context, in *rud
return &rudderAPI.UpgradeReleaseResponse{}, err
}
// ReleaseStatus retrieves release status
func (r *ReleaseModuleServiceServer) ReleaseStatus(ctx context.Context, in *rudderAPI.ReleaseStatusRequest) (*rudderAPI.ReleaseStatusResponse, error) {
grpclog.Print("status")

@ -572,5 +572,5 @@ func tarFromLocalDir(chartpath string, name string, repo string, version string)
return ch.Metadata.Version, err
}
return "", fmt.Errorf("Can't get a valid version for dependency %s.", name)
return "", fmt.Errorf("can't get a valid version for dependency %s", name)
}

@ -123,7 +123,7 @@ func newGetFailingKubeClient() *getFailingKubeClient {
}
func (p *getFailingKubeClient) Get(ns string, r io.Reader) (string, error) {
return "", errors.New("In the end, they did not find Nemo.")
return "", errors.New("in the end, they did not find Nemo")
}
type deleteFailingKubeClient struct {

Loading…
Cancel
Save