Commit e8aa8d36 authored by Matt Butcher's avatar Matt Butcher Committed by GitHub

Merge pull request #2405 from sushilkm/linting-fixes

Fixed issues reported by test-style
parents a9f0be9b 61c3a44d
...@@ -88,6 +88,8 @@ test: test-unit ...@@ -88,6 +88,8 @@ test: test-unit
.PHONY: test-unit .PHONY: test-unit
test-unit: test-unit:
@echo
@echo "==> Running unit tests <=="
HELM_HOME=/no/such/dir $(GO) test $(GOFLAGS) -run $(TESTS) $(PKG) $(TESTFLAGS) HELM_HOME=/no/such/dir $(GO) test $(GOFLAGS) -run $(TESTS) $(PKG) $(TESTFLAGS)
.PHONY: test-style .PHONY: test-style
......
...@@ -53,7 +53,7 @@ func newCompletionCmd(out io.Writer) *cobra.Command { ...@@ -53,7 +53,7 @@ func newCompletionCmd(out io.Writer) *cobra.Command {
Short: "Generate autocompletions script for the specified shell (bash or zsh)", Short: "Generate autocompletions script for the specified shell (bash or zsh)",
Long: completionDesc, Long: completionDesc,
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
return RunCompletion(out, cmd, args) return runCompletion(out, cmd, args)
}, },
ValidArgs: shells, ValidArgs: shells,
} }
...@@ -61,16 +61,16 @@ func newCompletionCmd(out io.Writer) *cobra.Command { ...@@ -61,16 +61,16 @@ func newCompletionCmd(out io.Writer) *cobra.Command {
return cmd 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 { if len(args) == 0 {
return fmt.Errorf("Shell not specified.") return fmt.Errorf("shell not specified")
} }
if len(args) > 1 { 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]] run, found := completionShells[args[0]]
if !found { if !found {
return fmt.Errorf("Unsupported shell type %q.", args[0]) return fmt.Errorf("unsupported shell type %q", args[0])
} }
return run(out, cmd) return run(out, cmd)
......
...@@ -73,7 +73,7 @@ func newFetchCmd(out io.Writer) *cobra.Command { ...@@ -73,7 +73,7 @@ func newFetchCmd(out io.Writer) *cobra.Command {
Long: fetchDesc, Long: fetchDesc,
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
if len(args) == 0 { 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++ { for i := 0; i < len(args); i++ {
fch.chartRef = args[i] fch.chartRef = args[i]
......
...@@ -72,7 +72,7 @@ func newPackageCmd(out io.Writer) *cobra.Command { ...@@ -72,7 +72,7 @@ func newPackageCmd(out io.Writer) *cobra.Command {
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
pkg.home = settings.Home pkg.home = settings.Home
if len(args) == 0 { 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.sign {
if pkg.key == "" { if pkg.key == "" {
......
...@@ -64,7 +64,7 @@ func TestPackage(t *testing.T) { ...@@ -64,7 +64,7 @@ func TestPackage(t *testing.T) {
name: "package without chart path", name: "package without chart path",
args: []string{}, args: []string{},
flags: map[string]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, err: true,
}, },
{ {
......
...@@ -85,7 +85,7 @@ func addRepository(name, url string, home helmpath.Home, certFile, keyFile, caFi ...@@ -85,7 +85,7 @@ func addRepository(name, url string, home helmpath.Home, certFile, keyFile, caFi
} }
if noUpdate && f.Has(name) { 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) cif := home.CacheIndex(name)
......
...@@ -96,7 +96,7 @@ func (d *resetCmd) run() error { ...@@ -96,7 +96,7 @@ func (d *resetCmd) run() error {
} }
if len(res.Releases) > 0 && !d.force { 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 { if err := installer.Uninstall(d.kubeClient, &installer.Options{Namespace: d.namespace}); err != nil {
......
...@@ -120,7 +120,7 @@ func TestReset_deployedReleases(t *testing.T) { ...@@ -120,7 +120,7 @@ func TestReset_deployedReleases(t *testing.T) {
namespace: api.NamespaceDefault, namespace: api.NamespaceDefault,
} }
err = cmd.run() 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) { if !strings.Contains(err.Error(), expected) {
t.Errorf("unexpected error: %v", err) t.Errorf("unexpected error: %v", err)
} }
......
...@@ -126,6 +126,7 @@ func (r *ReleaseModuleServiceServer) UpgradeRelease(ctx context.Context, in *rud ...@@ -126,6 +126,7 @@ func (r *ReleaseModuleServiceServer) UpgradeRelease(ctx context.Context, in *rud
return &rudderAPI.UpgradeReleaseResponse{}, err return &rudderAPI.UpgradeReleaseResponse{}, err
} }
// ReleaseStatus retrieves release status
func (r *ReleaseModuleServiceServer) ReleaseStatus(ctx context.Context, in *rudderAPI.ReleaseStatusRequest) (*rudderAPI.ReleaseStatusResponse, error) { func (r *ReleaseModuleServiceServer) ReleaseStatus(ctx context.Context, in *rudderAPI.ReleaseStatusRequest) (*rudderAPI.ReleaseStatusResponse, error) {
grpclog.Print("status") grpclog.Print("status")
......
...@@ -572,5 +572,5 @@ func tarFromLocalDir(chartpath string, name string, repo string, version string) ...@@ -572,5 +572,5 @@ func tarFromLocalDir(chartpath string, name string, repo string, version string)
return ch.Metadata.Version, err 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 { ...@@ -123,7 +123,7 @@ func newGetFailingKubeClient() *getFailingKubeClient {
} }
func (p *getFailingKubeClient) Get(ns string, r io.Reader) (string, error) { 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 { type deleteFailingKubeClient struct {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment